-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This required some refactorings to ensure type safety.
- Loading branch information
1 parent
57adf5f
commit 8119e1a
Showing
24 changed files
with
5,331 additions
and
528 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 was deleted.
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,26 @@ | ||
import { erroz } from "../src/main"; | ||
|
||
erroz.options.toJSON = function () { | ||
return { | ||
name: this.name, | ||
code: this.code, | ||
}; | ||
}; | ||
|
||
const DuplicateError = erroz({ | ||
name: "Duplicate", | ||
code: "duplicate", | ||
statusCode: 409, | ||
template: "Resource %resource (%id) already exists", | ||
}); | ||
|
||
const err = new DuplicateError({ resource: "Unicorn", id: 1 }); | ||
|
||
console.log(JSON.stringify(err)); | ||
|
||
/* | ||
{ | ||
"name": "Duplicate", | ||
"code": "duplicate" | ||
} | ||
*/ |
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.