-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GotHttpAdapter will now throw ParseError in case error body could not…
… be parsed
- Loading branch information
Todor Petrov
committed
Apr 19, 2021
1 parent
4195e77
commit 05a77b9
Showing
3 changed files
with
84 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
type ConstructorParams<ResponseBodyType = unknown> = { | ||
message: string; | ||
responseBody: ResponseBodyType; | ||
} | ||
|
||
class ParseError<ResponseBodyType = unknown> extends Error { | ||
public readonly responseBody: ResponseBodyType; | ||
|
||
constructor(params: ConstructorParams<ResponseBodyType>) { | ||
super(params.message); | ||
|
||
this.name = 'ParseError'; | ||
this.responseBody = params.responseBody; | ||
} | ||
} | ||
|
||
export default ParseError; |
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