This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
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.
- Loading branch information
1 parent
46b0e40
commit 0557893
Showing
18 changed files
with
187 additions
and
126 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,12 @@ | ||
import 'package:restrr/restrr.dart'; | ||
|
||
import '../../internal/requests/client_errors.dart'; | ||
|
||
class ClientException extends RestrrException { | ||
final ClientError error; | ||
|
||
ClientException(this.error) : super(error.message); | ||
|
||
@override | ||
String toString() => '${runtimeType.toString()}: $message'; | ||
} |
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,8 @@ | ||
abstract class RestrrException implements Exception { | ||
final String? message; | ||
|
||
RestrrException(this.message); | ||
|
||
@override | ||
String toString() => '${runtimeType.toString()}: $message'; | ||
} |
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,11 @@ | ||
import '../../../restrr.dart'; | ||
import '../../internal/requests/restrr_errors.dart'; | ||
|
||
class ServerException extends RestrrException { | ||
final RestrrError error; | ||
|
||
ServerException(this.error) : super(error.message); | ||
|
||
@override | ||
String toString() => '${runtimeType.toString()}: $message (${error.code})'; | ||
} |
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 was deleted.
Oops, something went wrong.
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,18 @@ | ||
import 'package:restrr/restrr.dart'; | ||
import 'package:restrr/src/internal/requests/responses/rest_response.dart'; | ||
|
||
enum ClientError { | ||
badRequest('Bad request'), | ||
|
||
noNetworkConnection('No network connection'), | ||
serverUnreachable('Server is unreachable'), | ||
invalidUri('Invalid URI'), | ||
; | ||
|
||
final String message; | ||
|
||
const ClientError(this.message); | ||
|
||
RestrrException toException() => ClientException(this); | ||
RestResponse<T> toResponse<T>({required int? statusCode}) => RestResponse<T>(error: toException(), statusCode: statusCode); | ||
} |
Oops, something went wrong.