File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Expand file tree Collapse file tree 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 =
33 | "ROUTE_NOT_FOUND"
44 | "AMOUNT_TOO_LOW"
55 | "AMOUNT_TOO_HIGH"
6+ | "INTERNAL_SERVER_ERROR"
67 | "UNKNOWN_ERROR" ;
78
89export class ApiError extends Error {
Original file line number Diff line number Diff line change @@ -9,26 +9,20 @@ type UiError = {
99// biome-ignore lint/suspicious/noExplicitAny: <explanation>
1010export function getErrorMessage ( err : any ) : UiError {
1111 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+ }
1219 return {
1320 code : err . code ,
1421 title : "Failed to Find Quote" ,
1522 message : getErrorMessageFromBridgeApiError ( err ) ,
1623 } ;
1724 }
1825
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-
3226 return {
3327 code : "UNABLE_TO_GET_PRICE_QUOTE" ,
3428 title : "Failed to Find Quote" ,
You can’t perform that action at this time.
0 commit comments