-
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.
feat: Gracefully handle non-English postcodes (#244)
* feat: Error handling for non-English postcodes * fix: Typos
- Loading branch information
1 parent
2a26cf3
commit 7769894
Showing
7 changed files
with
77 additions
and
9 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
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,22 @@ | ||
export type APIErrorCode = | ||
| "ITL3_NOT_FOUND" | ||
| "INSUFFICIENT_PRICES_PAID_DATA" | ||
| "UNHANDLED_EXCEPTION"; | ||
|
||
interface APIErrorParams { | ||
code: APIErrorCode; | ||
message: string; | ||
status?: number; | ||
} | ||
|
||
export class APIError extends Error { | ||
public code: APIErrorCode; | ||
public status: number; | ||
|
||
constructor({ code, message, status = 500 }: APIErrorParams) { | ||
super(message); | ||
this.name = "APIError"; | ||
this.code = code; | ||
this.status = status; | ||
} | ||
} |
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