-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add .name property to errors (#140)
Adds a .name property to errors used as rejection reasons.
- Loading branch information
1 parent
55262a8
commit 025ede0
Showing
4 changed files
with
48 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* The incoming stream ended before the expected number of bytes were read | ||
*/ | ||
export class UnexpectedEOFError extends Error { | ||
name = 'UnexpectedEOFError' | ||
code = 'ERR_UNEXPECTED_EOF' | ||
} |
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,25 @@ | ||
/** | ||
* The reported length of the next data message was not a positive integer | ||
*/ | ||
export class InvalidMessageLengthError extends Error { | ||
name = 'InvalidMessageLengthError' | ||
code = 'ERR_INVALID_MSG_LENGTH' | ||
} | ||
|
||
/** | ||
* The reported length of the next data message was larger than the configured | ||
* max allowable value | ||
*/ | ||
export class InvalidDataLengthError extends Error { | ||
name = 'InvalidDataLengthError' | ||
code = 'ERR_MSG_DATA_TOO_LONG' | ||
} | ||
|
||
/** | ||
* The varint used to specify the length of the next data message contained more | ||
* bytes than the configured max allowable value | ||
*/ | ||
export class InvalidDataLengthLengthError extends Error { | ||
name = 'InvalidDataLengthLengthError' | ||
code = 'ERR_MSG_LENGTH_TOO_LONG' | ||
} |
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