Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion shell/src/lib/error-boundary-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export function describeUnknownError(error: unknown): string {
if (error instanceof globalThis.Error) return `${error.name}: ${error.message}`;
try {
return String(error);
} catch {
} catch (stringifyError) {
if (stringifyError instanceof globalThis.Error) {
return `Unstringifiable value (${stringifyError.name})`;
}
return typeof error;
}
Comment on lines +19 to 24
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The caught stringifyError is never logged. CLAUDE.md's error-handling rule states every catch must "at minimum, log the error." Because String(error) throwing is a genuine (if rare) failure signal, silently swallowing it makes this class of pathological values invisible in production traces.

Suggested change
} catch (stringifyError) {
if (stringifyError instanceof globalThis.Error) {
return `Unstringifiable value (${stringifyError.name})`;
}
return typeof error;
}
} catch (stringifyError) {
if (stringifyError instanceof globalThis.Error) {
console.error("describeUnknownError: String() threw", stringifyError);
return `Unstringifiable value (${stringifyError.name})`;
}
console.error("describeUnknownError: String() threw non-Error", stringifyError);
return typeof error;
}

Context Used: CLAUDE.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: shell/src/lib/error-boundary-utils.ts
Line: 19-24

Comment:
The caught `stringifyError` is never logged. CLAUDE.md's error-handling rule states every catch must "at minimum, log the error." Because `String(error)` throwing is a genuine (if rare) failure signal, silently swallowing it makes this class of pathological values invisible in production traces.

```suggestion
  } catch (stringifyError) {
    if (stringifyError instanceof globalThis.Error) {
      console.error("describeUnknownError: String() threw", stringifyError);
      return `Unstringifiable value (${stringifyError.name})`;
    }
    console.error("describeUnknownError: String() threw non-Error", stringifyError);
    return typeof error;
  }
```

**Context Used:** CLAUDE.md ([source](https://app.greptile.com/finna/github/hamedmp/matrix-os/-/custom-context?memory=7363726a-a178-4b9b-a535-bc60be181a1a))

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

}
Loading
Loading