forked from getlift/lift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate user errors from bugs in the CLI output and telemetry
- Loading branch information
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
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,17 @@ | ||
/** | ||
* Represents a user error. | ||
* | ||
* This class mirrors the official ServerlessError class: | ||
* https://github.com/serverless/serverless/blob/f4c9b58b10a45ae342934e9a61dcdea0c2ef11e2/lib/serverless-error.js | ||
* The original class is available via `serverless.classes.Error` but that means | ||
* we must hold an instance of the `serverless` object to use it. | ||
* That isn't always the case, for example in constructs, which are decoupled from the `serverless` object. | ||
*/ | ||
export default class ServerlessError extends Error { | ||
private code: string; | ||
constructor(message: string, code: string) { | ||
super(message); | ||
this.name = "ServerlessError"; | ||
this.code = code; | ||
} | ||
} |