@@ -248,17 +248,15 @@ export class GatewayApiClient {
248248 if ( ! response . ok ) {
249249 const errorData = await response . json ( ) . catch ( ( ) => null ) ;
250250 const errorMessage = errorData ?. message || 'Failed to get onramp liquidity' ;
251- throw new Error ( `Onramp liquidity API Error: ${ errorMessage } ` ) ;
251+ throw new Error ( errorMessage ) ;
252252 }
253253
254254 const jsonResponse = await response . json ( ) ;
255255
256256 if ( ! jsonResponse . orderDetails ) {
257257 const errorData = jsonResponse . errorData ;
258258 const apiMessage = errorData ?. message ;
259- const errorMessage = apiMessage
260- ? `Failed to get onramp quote: ${ apiMessage } `
261- : 'Failed to get onramp quote' ;
259+ const errorMessage = apiMessage || 'Failed to get onramp quote' ;
262260 throw new Error ( errorMessage ) ;
263261 }
264262
@@ -310,9 +308,7 @@ export class GatewayApiClient {
310308 if ( ! response . ok ) {
311309 const errorData = await response . json ( ) . catch ( ( ) => null ) ;
312310 const apiMessage = errorData ?. message ;
313- const errorMessage = apiMessage
314- ? `Failed to fetch offramp registry contract: ${ apiMessage } `
315- : 'Failed to fetch offramp registry contract' ;
311+ const errorMessage = apiMessage || 'Failed to fetch offramp registry contract' ;
316312 throw new Error ( errorMessage ) ;
317313 }
318314 return response . text ( ) as Promise < Address > ;
@@ -337,7 +333,7 @@ export class GatewayApiClient {
337333 if ( ! response . ok ) {
338334 const errorData = await response . json ( ) . catch ( ( ) => null ) ;
339335 const errorMessage = errorData ?. message || 'Failed to get offramp liquidity' ;
340- throw new Error ( `Offramp liquidity API Error: ${ errorMessage } ` ) ;
336+ throw new Error ( errorMessage ) ;
341337 }
342338
343339 const rawLiquidity = await response . json ( ) ;
@@ -373,9 +369,7 @@ export class GatewayApiClient {
373369 if ( ! response . ok ) {
374370 const errorData = await response . json ( ) . catch ( ( ) => null ) ;
375371 const apiMessage = errorData ?. message ;
376- const errorMessage = apiMessage
377- ? `Failed to get offramp quote: ${ apiMessage } `
378- : `Failed to get offramp quote` ;
372+ const errorMessage = apiMessage || `Failed to get offramp quote` ;
379373 throw new Error ( `${ errorMessage } | queryParams: ${ queryParams } ` ) ;
380374 }
381375
@@ -702,7 +696,7 @@ export class GatewayApiClient {
702696 if ( ! response . ok ) {
703697 const errorData = await response . json ( ) . catch ( ( ) => null ) ;
704698 const apiMessage = errorData ?. message ;
705- const errorMessage = apiMessage ? `Failed to create order: ${ apiMessage } ` : 'Failed to create order' ;
699+ const errorMessage = apiMessage || 'Failed to create order' ;
706700 throw new Error ( errorMessage ) ;
707701 }
708702
@@ -931,7 +925,7 @@ export class GatewayApiClient {
931925 if ( ! response . ok ) {
932926 const errorData = await response . json ( ) . catch ( ( ) => null ) ;
933927 const apiMessage = errorData ?. message ;
934- const errorMessage = apiMessage ? `Failed to update order: ${ apiMessage } ` : `Failed to update order` ;
928+ const errorMessage = apiMessage || `Failed to update order` ;
935929 throw new Error ( errorMessage ) ;
936930 }
937931
@@ -1097,9 +1091,7 @@ export class GatewayApiClient {
10971091 if ( ! response . ok ) {
10981092 const errorData = await response . json ( ) . catch ( ( ) => null ) ;
10991093 const apiMessage = errorData ?. message ;
1100- const errorMessage = apiMessage
1101- ? `Failed to fetch supported token addresses: ${ apiMessage } `
1102- : 'Failed to fetch supported token addresses' ;
1094+ const errorMessage = apiMessage || 'Failed to fetch supported token addresses' ;
11031095 throw new Error ( errorMessage ) ;
11041096 }
11051097 return response . json ( ) ;
0 commit comments