@silentswap/sdk 0.0.84 → 0.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/quote-utils.js +10 -0
- package/package.json +1 -1
package/dist/quote-utils.js
CHANGED
|
@@ -179,6 +179,16 @@ export function selectBestQuote(relayQuote, debridgeQuote, srcAmount, relayRejec
|
|
|
179
179
|
const debridgeMetrics = viableDebridge ? calculateDebridgeMetrics(viableDebridge) : null;
|
|
180
180
|
// Both providers failed or have no usable response (no tx and no estimation)
|
|
181
181
|
if (!viableRelay && !viableDebridge) {
|
|
182
|
+
// If either provider was aborted, re-throw as AbortError so callers can
|
|
183
|
+
// distinguish a cancellation from a real failure (avoids showing error UI
|
|
184
|
+
// when all requests were simply superseded by a newer request).
|
|
185
|
+
const isAborted = (reason) => reason instanceof Error && reason.name === 'AbortError';
|
|
186
|
+
if (isAborted(relayRejection) || isAborted(debridgeRejection)) {
|
|
187
|
+
const abort = (relayRejection instanceof Error && relayRejection.name === 'AbortError')
|
|
188
|
+
? relayRejection
|
|
189
|
+
: debridgeRejection;
|
|
190
|
+
throw abort;
|
|
191
|
+
}
|
|
182
192
|
const message = getQuoteProviderErrorMessage(relayRejection, debridgeRejection);
|
|
183
193
|
throw new Error(message);
|
|
184
194
|
}
|