-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from labd/errorHandling
chore: custom errors
- Loading branch information
Showing
6 changed files
with
103 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"react-loqate": major | ||
--- | ||
|
||
Breaking: implement LoqateError and ReactLoqateError |
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,41 @@ | ||
type ReactLocateErrorCode = 'NO_ITEMS_RETRIEVED'; | ||
|
||
export class ReactLoqateError extends Error { | ||
public code: ReactLocateErrorCode; | ||
|
||
constructor({ | ||
message, | ||
code, | ||
}: { | ||
message: string; | ||
code: ReactLocateErrorCode; | ||
}) { | ||
super(message); | ||
this.code = code; | ||
} | ||
} | ||
|
||
export class LoqateError extends Error { | ||
public Cause: string; | ||
public Description: string; | ||
public Error: string; | ||
public Resolution: string; | ||
|
||
constructor({ | ||
Description, | ||
Cause, | ||
Error, | ||
Resolution, | ||
}: { | ||
Description: string; | ||
Cause: string; | ||
Error: string; | ||
Resolution: string; | ||
}) { | ||
super(Description); | ||
this.Cause = Cause; | ||
this.Description = Description; | ||
this.Error = Error; | ||
this.Resolution = Resolution; | ||
} | ||
} |
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