feat(apps): improve ErrorMessage type safety#1524
Merged
Conversation
🦋 Changeset detectedLatest commit: 0a98037 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
64443c3 to
13b5c6f
Compare
13b5c6f to
0a98037
Compare
There was a problem hiding this comment.
Pull request overview
Updates the ErrorMessage component (in both Heureka and Greenhouse apps) to accept unknown errors and safely derive a displayable name/message without as Error casts, aligning with react-error-boundary’s unknown-typed errors.
Changes:
- Widen
ErrorMessage’serrorprop fromErrortounknownand add type-guarded formatting (Error,string, fallback). - Remove unsafe casts at call sites and pass through
unknownerrors directly. - Add unit tests covering
stringand non-Errorunknown error inputs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/heureka/src/components/common/getErrorDataRow.tsx | Removes as Error cast; passes unknown error into ErrorMessage. |
| apps/heureka/src/components/common/Filters/index.tsx | Removes as Error cast when forwarding react-error-boundary error. |
| apps/heureka/src/components/common/Filters/PlaceHolderFilterSelect.tsx | Widens error prop to unknown and changes how errortext is derived. |
| apps/heureka/src/components/common/ErrorBoundary/ErrorMessage.tsx | Adds unknown-safe error normalization and updates rendering. |
| apps/heureka/src/components/common/ErrorBoundary/ErrorMessage.test.tsx | Adds tests for string and unknown-object errors. |
| apps/greenhouse/src/components/admin/common/getErrorDataRow.tsx | Removes as Error cast; passes unknown error into ErrorMessage. |
| apps/greenhouse/src/components/admin/common/YamlViewer.tsx | Passes string error directly into ErrorMessage instead of wrapping in Error. |
| apps/greenhouse/src/components/admin/common/ErrorBoundary/ErrorMessage.tsx | Adds unknown-safe error normalization and updates rendering. |
| apps/greenhouse/src/components/admin/common/ErrorBoundary/ErrorMessage.test.tsx | Adds tests for string and unknown-object errors. |
| .changeset/improve-error-message-type-safety.md | Records patch release for both apps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/greenhouse/src/components/admin/common/ErrorBoundary/ErrorMessage.tsx
Show resolved
Hide resolved
edda
approved these changes
Mar 11, 2026
ArtieReus
approved these changes
Mar 12, 2026
hodanoori
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improve
ErrorMessagecomponent to acceptunknownerror types, eliminating unsafe type casting.Changes Made
errorprop type fromErrortounknownError,string, andunknowntypesstringerror handlingRelated Issues
Testing Instructions
pnpm ipnpm test ErrorMessagepnpm typecheckChecklist