@marianmeres/http-utils 1.14.0 → 1.16.0

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/index.cjs CHANGED
@@ -290,12 +290,13 @@ const getErrorMessage = (e, stripErrorPrefix = true) => {
290
290
  // e.cause is the standard prop for error details, so should be considered as
291
291
  // the most authoritative (if available)
292
292
  // "code" and "message" are my own conventions
293
- cause?.code ||
294
- cause?.message ||
293
+ cause?.message ||
294
+ cause?.code ||
295
295
  (typeof cause === 'string' ? cause : null) ||
296
296
  // non-standard "body" is this package's HttpError prop
297
297
  body?.error?.message ||
298
298
  body?.message ||
299
+ body?.error ||
299
300
  (typeof body === 'string' ? body : null) ||
300
301
  // the common message from Error ctor (e.g. "Foo" if new TypeError("Foo"))
301
302
  e?.message ||
@@ -305,7 +306,7 @@ const getErrorMessage = (e, stripErrorPrefix = true) => {
305
306
  e?.toString() ||
306
307
  // very last fallback if `toString()` was not available (or returned empty)
307
308
  'Unknown Error';
308
- // cast to string
309
+ // ensure we're sending string
309
310
  msg = `${msg}`;
310
311
  if (stripErrorPrefix) {
311
312
  msg = msg.replace(/^[^:]*Error: /, '');
package/dist/index.js CHANGED
@@ -288,12 +288,13 @@ const getErrorMessage = (e, stripErrorPrefix = true) => {
288
288
  // e.cause is the standard prop for error details, so should be considered as
289
289
  // the most authoritative (if available)
290
290
  // "code" and "message" are my own conventions
291
- cause?.code ||
292
- cause?.message ||
291
+ cause?.message ||
292
+ cause?.code ||
293
293
  (typeof cause === 'string' ? cause : null) ||
294
294
  // non-standard "body" is this package's HttpError prop
295
295
  body?.error?.message ||
296
296
  body?.message ||
297
+ body?.error ||
297
298
  (typeof body === 'string' ? body : null) ||
298
299
  // the common message from Error ctor (e.g. "Foo" if new TypeError("Foo"))
299
300
  e?.message ||
@@ -303,7 +304,7 @@ const getErrorMessage = (e, stripErrorPrefix = true) => {
303
304
  e?.toString() ||
304
305
  // very last fallback if `toString()` was not available (or returned empty)
305
306
  'Unknown Error';
306
- // cast to string
307
+ // ensure we're sending string
307
308
  msg = `${msg}`;
308
309
  if (stripErrorPrefix) {
309
310
  msg = msg.replace(/^[^:]*Error: /, '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/http-utils",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "Misc DRY http fetch related helpers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",