Skip to content

Commit

Permalink
Merge pull request #185 from brayden-wong/update-error-constructors
Browse files Browse the repository at this point in the history
(Update-error constructors) my PR got merged and closed somehow with 0 commits in it???
  • Loading branch information
SaltyAom authored Sep 20, 2023
2 parents 59d4eed + fc1a218 commit 1fa8a4c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,29 @@ export class InternalServerError extends Error {
code = 'INTERNAL_SERVER_ERROR'
status = 500

constructor() {
super('INTERNAL_SERVER_ERROR')
constructor(message: string)
constructor(message?: string) {
super(message ?? 'INTERNAL_SERVER_ERROR')
}
}

export class NotFoundError extends Error {
code = 'NOT_FOUND'
status = 404

constructor() {
super('NOT_FOUND')
constructor(message: string)
constructor(message?: string) {
super(message ?? 'NOT_FOUND')
}
}

export class ParseError extends Error {
code = 'PARSE'
status = 400

constructor() {
super('PARSE')
constructor(message: string)
constructor(message?: string) {
super(message ?? 'PARSE')
}
}

Expand Down

0 comments on commit 1fa8a4c

Please # to comment.