@workbuddy/cli-edge 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2542,7 +2542,12 @@ function buildHttpErrorMessage(status, contentType, buffer) {
2542
2542
  if (contentType.includes("application/json")) {
2543
2543
  try {
2544
2544
  const parsed = JSON.parse(text);
2545
- const detail = parsed.message ?? parsed.error ?? parsed.details;
2545
+ const errorObj = parsed?.error;
2546
+ if (errorObj && typeof errorObj === "object") {
2547
+ const msg = errorObj.message ?? errorObj.code ?? JSON.stringify(errorObj);
2548
+ return "Request failed with status " + status + ": " + msg;
2549
+ }
2550
+ const detail = parsed?.message ?? (typeof errorObj === "string" ? errorObj : null) ?? parsed?.details;
2546
2551
  return detail ? "Request failed with status " + status + ": " + detail : "Request failed with status " + status + ": " + text;
2547
2552
  } catch {
2548
2553
  return "Request failed with status " + status + ": " + text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbuddy/cli-edge",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "WorkBuddy command line interface",
5
5
  "license": "MIT",
6
6
  "type": "module",