@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.
- package/dist/index.js +6 -1
- 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
|
|
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;
|