Skip to content

fix: add error logging to empty catch blocks#1794

Open
gugli4ifenix-design wants to merge 1 commit into
chaitin:mainfrom
gugli4ifenix-design:fix/empty-catch-error-logging
Open

fix: add error logging to empty catch blocks#1794
gugli4ifenix-design wants to merge 1 commit into
chaitin:mainfrom
gugli4ifenix-design:fix/empty-catch-error-logging

Conversation

@gugli4ifenix-design
Copy link
Copy Markdown

Problem

6 empty catch blocks across 5 files silently swallow errors:

  • httpClient.ts (×2): Response parsing errors are invisible — if the server returns malformed JSON, data silently stays undefined
  • mermaidRenderer.tsx: Mermaid diagram render failures are hidden
  • editor/index.tsx (×2): Editor errors are suppressed
  • ShowText/index.tsx: Content parse errors are silenced

Fix

Add console.warn to all empty catch blocks:

// Before
} catch (error) {}

// After  
} catch (error) { console.warn("[PandaWiki] Response parse error:", error); }
  • 5 files, 6 catches updated
  • Behavior unchanged — errors are caught, not thrown
  • Debugging improved — errors are now visible in console

Found during a static analysis sweep of 97 popular open source projects.

5 files with silent error swallowing:
- httpClient.ts: response parsing errors hidden
- mermaidRenderer.tsx: render failures invisible
- editor/index.tsx: editor errors suppressed
- ShowText/index.tsx: parse errors silenced

Adds console.warn to make errors visible during development
while preserving existing fail-safe behavior.

Found during a static analysis of 97 popular open source projects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant