Raise exception on spreadsheet errors instead of silently skipping
**Problem:** The _is_spreadsheet_error() check was logging a warning and silently skipping rows with formula errors (#REF!, #N/A, etc.). This could lead to incomplete game data being submitted without the user knowing. **Solution:** Raise SheetsException immediately when spreadsheet errors are detected, providing: - Exact row number and field name - Actual error value found in the cell - Common error type explanations - Clear action required to fix **Impact:** - Users get immediate feedback about spreadsheet errors - No partial/incomplete data submitted to API - Clear instructions on what needs to be fixed - Better data integrity **Example Error Message:** ``` ❌ Spreadsheet Error Detected **Location:** Row 7, Column 'pitcher_id' **Value Found:** `#REF!` This cell contains a formula error that must be fixed before submission. **Action Required:** Fix cell pitcher_id in row 7 and resubmit. ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ff3f9a0d1d
commit
1d08dc1755
@ -315,11 +315,19 @@ class SheetsService:
|
||||
|
||||
# Check for spreadsheet errors
|
||||
if self._is_spreadsheet_error(value):
|
||||
self.logger.warning(
|
||||
f"Row {row_num}: Spreadsheet error '{value}' in field '{field_name}' - skipping row"
|
||||
raise SheetsException(
|
||||
f"❌ Spreadsheet Error Detected\n\n"
|
||||
f"**Location:** Row {row_num}, Column '{field_name}'\n"
|
||||
f"**Value Found:** `{value}`\n\n"
|
||||
f"This cell contains a formula error that must be fixed before submission.\n\n"
|
||||
f"**Common Error Types:**\n"
|
||||
f"• `#REF!` - Invalid cell reference (deleted row/column)\n"
|
||||
f"• `#N/A` - Lookup formula couldn't find a match\n"
|
||||
f"• `#VALUE!` - Wrong data type in formula\n"
|
||||
f"• `#DIV/0!` - Division by zero\n"
|
||||
f"• `#NAME?` - Unrecognized formula name\n\n"
|
||||
f"**Action Required:** Fix cell {field_name} in row {row_num} and resubmit."
|
||||
)
|
||||
has_error = True
|
||||
break
|
||||
|
||||
# Sanitize integer fields
|
||||
if field_name in int_fields:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user