Skip to content

Add graceful error handling for incomplete GeoJSON during live editing #5

@deftio

Description

@deftio

Problem

During live editing, incomplete GeoJSON content causes console errors as SquibView attempts to parse malformed JSON:

Error rendering GeoJSON: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at t.value (squibview.js:1134:29)

This happens because the live editor processes content as users type, resulting in temporarily invalid JSON structures.

Expected Behavior

  • GeoJSON parsing should fail gracefully without console errors
  • Invalid JSON should display a helpful message instead of throwing errors
  • Live editing experience should remain smooth

Proposed Solution

  • Add try-catch blocks around JSON parsing in GeoJSON renderer
  • Display helpful error states for invalid JSON
  • Only attempt parsing when JSON appears structurally complete

Impact

  • Better user experience during live editing
  • Cleaner browser console
  • More robust error handling

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions