File tree 3 files changed +13
-13
lines changed 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ Better Quote errors
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ type ErrorCode =
3
3
| "ROUTE_NOT_FOUND"
4
4
| "AMOUNT_TOO_LOW"
5
5
| "AMOUNT_TOO_HIGH"
6
+ | "INTERNAL_SERVER_ERROR"
6
7
| "UNKNOWN_ERROR" ;
7
8
8
9
export class ApiError extends Error {
Original file line number Diff line number Diff line change @@ -9,26 +9,20 @@ type UiError = {
9
9
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
10
10
export function getErrorMessage ( err : any ) : UiError {
11
11
if ( err instanceof ApiError ) {
12
+ if ( err . code === "INTERNAL_SERVER_ERROR" ) {
13
+ return {
14
+ code : "INTERNAL_SERVER_ERROR" ,
15
+ title : "Failed to Find Quote" ,
16
+ message : "An unknown error occurred. Please try again." ,
17
+ } ;
18
+ }
12
19
return {
13
20
code : err . code ,
14
21
title : "Failed to Find Quote" ,
15
22
message : getErrorMessageFromBridgeApiError ( err ) ,
16
23
} ;
17
24
}
18
25
19
- if ( typeof err . error === "object" && err . error . code ) {
20
- if ( err . error . code === "MINIMUM_PURCHASE_AMOUNT" ) {
21
- return {
22
- code : "MINIMUM_PURCHASE_AMOUNT" ,
23
- title : "Amount Too Low" ,
24
- message :
25
- "The requested amount is less than the minimum purchase. Try another provider or amount." ,
26
- } ;
27
- }
28
- }
29
-
30
- console . error ( err ) ;
31
-
32
26
return {
33
27
code : "UNABLE_TO_GET_PRICE_QUOTE" ,
34
28
title : "Failed to Find Quote" ,
You can’t perform that action at this time.
0 commit comments