fix: improve error handling in ServerSorobanSVG component
Removed unnecessary throw statement that was breaking component error handling. The component already gracefully handles errors by setting error state and displaying fallback UI, so throwing was causing crashes instead of graceful degradation. Also fixed TypeScript type issues with DOM element casting. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -63,7 +63,6 @@ export function ServerSorobanSVG({
|
||||
} catch (err) {
|
||||
console.error(`Failed to generate SVG for ${number}:`, err)
|
||||
setError('Unable to generate SVG')
|
||||
throw new Error(`Failed to generate SVG for number ${number}: ${err instanceof Error ? err.message : 'Unknown error'}`)
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
@@ -136,7 +135,7 @@ function processSVGForDisplay(svgContent: string, targetWidth: number, targetHei
|
||||
}
|
||||
|
||||
// Get the bounding box of all actual content
|
||||
let bounds = calculateSVGContentBounds(svgElement)
|
||||
let bounds = calculateSVGContentBounds(svgElement as unknown as SVGSVGElement)
|
||||
|
||||
if (!bounds) {
|
||||
// Fallback to original if we can't calculate bounds
|
||||
@@ -253,7 +252,7 @@ function extractPathCoordinates(pathData: string): { x: number; y: number }[] {
|
||||
}
|
||||
|
||||
function applyElementTransforms(point: { x: number; y: number }, element: Element, rootSVG: SVGSVGElement): { x: number; y: number } {
|
||||
let current = element
|
||||
let current: Element | null = element
|
||||
let transformedPoint = { ...point }
|
||||
|
||||
// Apply transforms from element up to root
|
||||
|
||||
Reference in New Issue
Block a user