@marianmeres/http-utils 1.14.0 → 1.15.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,8 +290,8 @@ 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 ||
@@ -305,7 +305,7 @@ const getErrorMessage = (e, stripErrorPrefix = true) => {
305
305
  e?.toString() ||
306
306
  // very last fallback if `toString()` was not available (or returned empty)
307
307
  'Unknown Error';
308
- // cast to string
308
+ // ensure we're sending string
309
309
  msg = `${msg}`;
310
310
  if (stripErrorPrefix) {
311
311
  msg = msg.replace(/^[^:]*Error: /, '');
package/dist/index.js CHANGED
@@ -288,8 +288,8 @@ 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 ||
@@ -303,7 +303,7 @@ const getErrorMessage = (e, stripErrorPrefix = true) => {
303
303
  e?.toString() ||
304
304
  // very last fallback if `toString()` was not available (or returned empty)
305
305
  'Unknown Error';
306
- // cast to string
306
+ // ensure we're sending string
307
307
  msg = `${msg}`;
308
308
  if (stripErrorPrefix) {
309
309
  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.15.0",
4
4
  "description": "Misc DRY http fetch related helpers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",