create-request 0.0.1-beta.10 → 0.0.1-beta.11
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.
|
@@ -1436,13 +1436,14 @@ class BaseRequest {
|
|
|
1436
1436
|
return selector(data);
|
|
1437
1437
|
}
|
|
1438
1438
|
catch (error) {
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1439
|
+
// Always enhance the error with the original data
|
|
1440
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1441
|
+
const enhancedError = new Error(`Data selector failed: ${errorMessage}. Original data: ${JSON.stringify(await basePromise.then(response => response.getJson()), null, 2)}`);
|
|
1442
|
+
// Preserve the stack trace if available
|
|
1443
|
+
if (error instanceof Error && error.stack) {
|
|
1442
1444
|
enhancedError.stack = error.stack;
|
|
1443
|
-
throw enhancedError;
|
|
1444
1445
|
}
|
|
1445
|
-
throw
|
|
1446
|
+
throw enhancedError;
|
|
1446
1447
|
}
|
|
1447
1448
|
};
|
|
1448
1449
|
return responsePromise;
|
package/dist/library/index.js
CHANGED
|
@@ -1442,13 +1442,14 @@
|
|
|
1442
1442
|
return selector(data);
|
|
1443
1443
|
}
|
|
1444
1444
|
catch (error) {
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1445
|
+
// Always enhance the error with the original data
|
|
1446
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1447
|
+
const enhancedError = new Error(`Data selector failed: ${errorMessage}. Original data: ${JSON.stringify(await basePromise.then(response => response.getJson()), null, 2)}`);
|
|
1448
|
+
// Preserve the stack trace if available
|
|
1449
|
+
if (error instanceof Error && error.stack) {
|
|
1448
1450
|
enhancedError.stack = error.stack;
|
|
1449
|
-
throw enhancedError;
|
|
1450
1451
|
}
|
|
1451
|
-
throw
|
|
1452
|
+
throw enhancedError;
|
|
1452
1453
|
}
|
|
1453
1454
|
};
|
|
1454
1455
|
return responsePromise;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-request",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.11",
|
|
4
4
|
"description": "A modern, chainable wrapper for fetch with automatic retries, timeouts, comprehensive error handling, and first-class TypeScript support",
|
|
5
5
|
"main": "dist/library/index.js",
|
|
6
6
|
"module": "dist/library/index.esm.js",
|