fix: resolve Python FileNotFoundError and improve error handling

- Add proper error handling around temp_typst.unlink() in generate.py to prevent crashes when temp file doesn't exist
- Modify ServerSorobanSVG component to throw errors instead of showing fallback when backend fails

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-09-14 17:21:36 -05:00
parent b8361eea50
commit 69bda9fb36
2 changed files with 6 additions and 3 deletions

View File

@ -63,8 +63,7 @@ export function ServerSorobanSVG({
} catch (err) {
console.error(`Failed to generate SVG for ${number}:`, err)
setError('Unable to generate SVG')
// Use fallback placeholder
setSvgContent(generateFallbackSVG(number, width, height))
throw new Error(`Failed to generate SVG for number ${number}: ${err instanceof Error ? err.message : 'Unknown error'}`)
} finally {
setIsLoading(false)
}

View File

@ -415,7 +415,11 @@ def main():
print(f"Generated: {output_path}")
# Clean up temp file
temp_typst.unlink()
try:
temp_typst.unlink()
except FileNotFoundError:
# Temp file may have already been cleaned up or not created
pass
# Add duplex printing hints and linearize if requested
if args.linearize: