-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@thunderstore/dapper-ts: improve error handling
Sentry handling doesn't need to be done on package level since we're doing it on app level. Try to throw useful error messages, taking into account I don't how much of the error stack is available on Sentry or NextJs logs this way. Refs no ticket
- Loading branch information
Showing
6 changed files
with
25 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ZodError } from "zod"; | ||
|
||
export const formatErrorMessage = (errors: ZodError) => { | ||
const issues = errors.issues.map( | ||
(issue) => ` ${issue.path.join(".")}: ${issue.message}` | ||
); | ||
|
||
issues.unshift( | ||
`Invalid data received from backend (${errors.issues.length}):` | ||
); | ||
|
||
return issues.join("\n"); | ||
}; |