-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a `.name` property to all errors that can be used in a more ideomatic way than `.code`.
- Loading branch information
1 parent
3490930
commit 3d70363
Showing
21 changed files
with
210 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
export class BadPathError extends Error { | ||
static name = 'BadPathError' | ||
static code = 'ERR_BAD_PATH' | ||
name = BadPathError.name | ||
code = BadPathError.code | ||
|
||
constructor (message = 'Bad path') { | ||
super(message) | ||
} | ||
} | ||
|
||
export class NotFoundError extends Error { | ||
static name = 'NotFoundError' | ||
static code = 'ERR_NOT_FOUND' | ||
name = NotFoundError.name | ||
code = NotFoundError.code | ||
|
||
constructor (message = 'Not found') { | ||
super(message) | ||
} | ||
} | ||
|
||
export class NoResolverError extends Error { | ||
static name = 'NoResolverError' | ||
static code = 'ERR_NO_RESOLVER' | ||
name = NoResolverError.name | ||
code = NoResolverError.code | ||
|
||
constructor (message = 'No resolver') { | ||
super(message) | ||
} | ||
} | ||
|
||
export class NotUnixFSError extends Error { | ||
static name = 'NotUnixFSError' | ||
static code = 'ERR_NOT_UNIXFS' | ||
name = NotUnixFSError.name | ||
code = NotUnixFSError.code | ||
|
||
constructor (message = 'Not UnixFS') { | ||
super(message) | ||
} | ||
} | ||
|
||
export class OverReadError extends Error { | ||
static name = 'OverReadError' | ||
static code = 'ERR_OVER_READ' | ||
name = OverReadError.name | ||
code = OverReadError.code | ||
|
||
constructor (message = 'Over read') { | ||
super(message) | ||
} | ||
} | ||
|
||
export class UnderReadError extends Error { | ||
static name = 'UnderReadError' | ||
static code = 'ERR_UNDER_READ' | ||
name = UnderReadError.name | ||
code = UnderReadError.code | ||
|
||
constructor (message = 'Under read') { | ||
super(message) | ||
} | ||
} | ||
|
||
export class NoPropError extends Error { | ||
static name = 'NoPropError' | ||
static code = 'ERR_NO_PROP' | ||
name = NoPropError.name | ||
code = NoPropError.code | ||
|
||
constructor (message = 'No Property found') { | ||
super(message) | ||
} | ||
} | ||
|
||
export class InvalidParametersError extends Error { | ||
static name = 'InvalidParametersError' | ||
static code = 'ERR_INVALID_PARAMS' | ||
name = InvalidParametersError.name | ||
code = InvalidParametersError.code | ||
|
||
constructor (message = 'Invalid parameters') { | ||
super(message) | ||
} | ||
} |
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
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.