Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 2ec067c

Browse files
authored
feat: Merge pull request #35 from seamapi/feat-better-validation-error
2 parents faf151d + 5179dce commit 2ec067c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib/api-error.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@ export class SeamActionAttemptError extends Error {
4242

4343
export class SeamMalformedInputError extends Error {
4444
constructor(public validationErrors: Record<string, unknown>) {
45-
super("Malformed input")
45+
super(`Malformed input: ${JSON.stringify(validationErrors, null, 2)}`)
4646

4747
if (Error.captureStackTrace) {
4848
Error.captureStackTrace(this, this.constructor)
4949
}
5050
}
5151

5252
toString() {
53-
return `SeamMalformedInputError: ${JSON.stringify(this.validationErrors)}`
53+
return `SeamMalformedInputError: ${JSON.stringify(
54+
this.validationErrors,
55+
null,
56+
2
57+
)}`
5458
}
5559
}

0 commit comments

Comments
 (0)