-
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.
Merge pull request #2 from obot-ai/AddException
Fetcherが想定外のレスポンスを取得した場合に例外を発生させるように改修
- Loading branch information
Showing
4 changed files
with
65 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class FetcherException implements Exception { | ||
final String message; | ||
|
||
FetcherException(this.message); | ||
|
||
@override | ||
String toString() { | ||
return 'FetcherException(message: $message)'; | ||
} | ||
} | ||
|
||
class FetchFailedException extends FetcherException { | ||
final int statusCode; | ||
final String responseBody; | ||
|
||
FetchFailedException(super.message, this.statusCode, this.responseBody); | ||
|
||
@override | ||
String toString() { | ||
return 'FetchFailedException(message: $message, statusCode: $statusCode)'; | ||
} | ||
} | ||
|
||
class UnexpectedResponseBodyException extends FetcherException { | ||
final int statusCode; | ||
|
||
UnexpectedResponseBodyException(super.message, this.statusCode); | ||
|
||
@override | ||
String toString() { | ||
return 'UnexpectedResponseBodyException(message: $message, statusCode: $statusCode)'; | ||
} | ||
} |
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