This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
6 changed files
with
388 additions
and
89 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,41 @@ | ||
class RequestError implements Exception { | ||
final String message; | ||
final String? url; | ||
final Exception? cause; | ||
|
||
RequestError({ | ||
required this.message, | ||
this.url, | ||
this.cause, | ||
}); | ||
|
||
String get errorType => 'RequestError'; | ||
|
||
@override | ||
String toString() => [ | ||
'$errorType: $message', | ||
if (url != null) 'Url: $url', | ||
if (cause != null) 'Caused by: $cause', | ||
].join('\n'); | ||
} | ||
|
||
class ResponseError implements Exception { | ||
final String message; | ||
final int? status; | ||
final String? body; | ||
|
||
ResponseError({ | ||
required this.message, | ||
this.status, | ||
this.body, | ||
}); | ||
|
||
String get errorType => 'ResponseError'; | ||
|
||
@override | ||
String toString() => [ | ||
'$errorType: $message', | ||
if (status != null) 'Status: $status', | ||
if (body != null) 'Body: $body', | ||
].join('\n'); | ||
} |
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,83 @@ | ||
// TODO(ethan-tbd): move to web5-dart when kcc is added to web5-dart | ||
class _TbdexTokenError implements Exception { | ||
final String message; | ||
final Exception? cause; | ||
|
||
_TbdexTokenError({ | ||
required this.message, | ||
this.cause, | ||
}); | ||
|
||
String get errorType => 'TbdexValidationError'; | ||
|
||
@override | ||
String toString() => [ | ||
'$errorType: $message', | ||
if (cause != null) 'Caused by: $cause', | ||
].join('\n'); | ||
} | ||
|
||
class RequestTokenError extends _TbdexTokenError { | ||
RequestTokenError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'RequestTokenError'; | ||
} | ||
|
||
class RequestTokenSigningError extends RequestTokenError { | ||
RequestTokenSigningError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'RequestTokenSigningError'; | ||
} | ||
|
||
class RequestTokenVerificationError extends RequestTokenError { | ||
RequestTokenVerificationError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'RequestTokenVerificationError'; | ||
} | ||
|
||
class RequestTokenMissingClaimsError extends RequestTokenError { | ||
RequestTokenMissingClaimsError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'RequestTokenMissingClaimsError'; | ||
} | ||
|
||
class RequestTokenAudienceMismatchError extends RequestTokenError { | ||
RequestTokenAudienceMismatchError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'RequestTokenAudienceMismatchError'; | ||
} |
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,56 @@ | ||
class _TbdexValidationError implements Exception { | ||
final String message; | ||
final Exception? cause; | ||
|
||
_TbdexValidationError({ | ||
required this.message, | ||
this.cause, | ||
}); | ||
|
||
String get errorType => 'TbdexValidationError'; | ||
|
||
@override | ||
String toString() => [ | ||
'$errorType: $message', | ||
if (cause != null) 'Caused by: $cause', | ||
].join('\n'); | ||
} | ||
|
||
class ValidationError extends _TbdexValidationError { | ||
ValidationError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'ValidationError'; | ||
} | ||
|
||
class InvalidDidError extends ValidationError { | ||
InvalidDidError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'InvalidDidError'; | ||
} | ||
|
||
class MissingServiceEndpointError extends ValidationError { | ||
MissingServiceEndpointError({ | ||
required String message, | ||
Exception? cause, | ||
}) : super( | ||
message: message, | ||
cause: cause, | ||
); | ||
|
||
@override | ||
String get errorType => 'MissingServiceEndpointError'; | ||
} |
Oops, something went wrong.