-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: treat unhandled exceptions in handlers as 500 error responses (#…
- Loading branch information
1 parent
43a163b
commit 5191399
Showing
12 changed files
with
288 additions
and
142 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,21 @@ | ||
import { InternalError } from './devUtils' | ||
|
||
describe(InternalError, () => { | ||
it('creates an InternalError instance', () => { | ||
const error = new InternalError('Message') | ||
|
||
expect(error.name).toBe('InternalError') | ||
expect(error.message).toBe('Message') | ||
expect(error.toString()).toBe('InternalError: Message') | ||
expect(error.stack).toMatch(/\w+/) | ||
}) | ||
|
||
it('passes the identity check', () => { | ||
const error = new InternalError('Message') | ||
expect(error instanceof InternalError).toBe(true) | ||
expect(error instanceof Error).toBe(true) | ||
|
||
const extraneousError = new Error('Message') | ||
expect(extraneousError).not.toBeInstanceOf(InternalError) | ||
}) | ||
}) |
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
Oops, something went wrong.