@netmind/arena-cli 0.35.0 → 0.35.1
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 +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -392,6 +392,8 @@ async function api(path3, opts = {}) {
|
|
|
392
392
|
const suffix = retryAfter !== void 0 ? ` (retry after ${retryAfter}s)` : "";
|
|
393
393
|
const err = new Error(`API error ${res.status}: ${msg}${suffix}`);
|
|
394
394
|
if (typeof data?.code === "string") err.code = data.code;
|
|
395
|
+
if (typeof data?.hint === "string") err.hint = data.hint;
|
|
396
|
+
if (typeof data?.docs === "string") err.docs = data.docs;
|
|
395
397
|
err.status = res.status;
|
|
396
398
|
if (retryAfter !== void 0) err.retryAfter = retryAfter;
|
|
397
399
|
throw err;
|
|
@@ -439,15 +441,21 @@ function isJsonMode(argv = process.argv) {
|
|
|
439
441
|
}
|
|
440
442
|
function printError(error) {
|
|
441
443
|
const message = error instanceof Error ? error.message : String(error);
|
|
444
|
+
const detail = error ?? {};
|
|
445
|
+
const hint = typeof detail.hint === "string" ? detail.hint : void 0;
|
|
446
|
+
const docs = typeof detail.docs === "string" ? detail.docs : void 0;
|
|
442
447
|
if (!isJsonMode()) {
|
|
443
448
|
console.error(`error: ${message}`);
|
|
449
|
+
if (hint) console.error(`hint: ${hint}`);
|
|
450
|
+
if (docs) console.error(`docs: ${docs}`);
|
|
444
451
|
return;
|
|
445
452
|
}
|
|
446
|
-
const detail = error ?? {};
|
|
447
453
|
const out = { error: message };
|
|
448
454
|
if (typeof detail.status === "number") out.status = detail.status;
|
|
449
455
|
if (typeof detail.code === "string") out.code = detail.code;
|
|
450
456
|
if (typeof detail.retryAfter === "number") out.retryAfter = detail.retryAfter;
|
|
457
|
+
if (hint) out.hint = hint;
|
|
458
|
+
if (docs) out.docs = docs;
|
|
451
459
|
console.log(JSON.stringify(out));
|
|
452
460
|
}
|
|
453
461
|
function printSuccess(msg) {
|