tsarr 2.7.4 → 2.7.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.
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/service.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,sBAAsB,UAA0D,CAAC;AAE9F,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,EAAE,CAM5E;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,EACnC,SAAS,EAAE,WAAW,EAAE,uDA+MzB"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/service.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,sBAAsB,UAA0D,CAAC;AAE9F,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,EAAE,CAM5E;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,EACnC,SAAS,EAAE,WAAW,EAAE,uDAsMzB"}
package/dist/cli/index.js CHANGED
@@ -5409,6 +5409,12 @@ function buildServiceCommand(serviceName, description, clientFactory, resources)
5409
5409
  const raw = await action.run(client2, resolvedArgs);
5410
5410
  if (raw?.error !== undefined) {
5411
5411
  const err = raw.error;
5412
+ const networkMsg = classifyNetworkError(err, serviceName);
5413
+ if (networkMsg) {
5414
+ consola.error(`${networkMsg}
5415
+ Run \`tsarr doctor\` to diagnose.`);
5416
+ process.exit(1);
5417
+ }
5412
5418
  const status = err?.status ?? raw?.response?.status;
5413
5419
  if (status === 401) {
5414
5420
  const authHint = serviceName === "qbittorrent" ? "Check your username and password." : `Check your API key.
@@ -5416,18 +5422,6 @@ Run \`tsarr config init\` or set TSARR_${serviceName.toUpperCase()}_API_KEY`;
5416
5422
  consola.error(`Unauthorized. ${authHint}`);
5417
5423
  } else if (status === 404) {
5418
5424
  consola.error("Not found.");
5419
- } else if (!status && err?.code) {
5420
- const code = err.code;
5421
- if (code === "ConnectionRefused" || code === "ECONNREFUSED") {
5422
- consola.error(`Connection refused. Is ${serviceName} running?
5423
- Run \`tsarr doctor\` to diagnose.`);
5424
- } else if (code === "ConnectionReset" || code === "ECONNRESET") {
5425
- consola.error(`Connection reset. ${serviceName} may have crashed.
5426
- Run \`tsarr doctor\` to diagnose.`);
5427
- } else {
5428
- consola.error(`${err?.message ?? `Network error (${code})`}
5429
- Run \`tsarr doctor\` to diagnose.`);
5430
- }
5431
5425
  } else {
5432
5426
  consola.error(err?.title ?? err?.message ?? `API error (${status ?? "unknown"})`);
5433
5427
  }
@@ -5538,9 +5532,12 @@ Run \`tsarr doctor\` to diagnose.`);
5538
5532
  process.exit(1);
5539
5533
  }
5540
5534
  function classifyNetworkError(error, serviceName) {
5541
- const cause = error.cause;
5542
- const code = cause?.code ?? error.code;
5543
- const msg = error.message;
5535
+ if (!error || typeof error !== "object")
5536
+ return null;
5537
+ const err = error;
5538
+ const cause = err.cause;
5539
+ const code = cause?.code ?? err.code;
5540
+ const msg = err.message ?? "";
5544
5541
  if (code === "ECONNREFUSED" || code === "ConnectionRefused") {
5545
5542
  return `Connection refused. Is ${serviceName} running?`;
5546
5543
  }
@@ -21346,8 +21343,10 @@ var init_doctor = __esm(() => {
21346
21343
  const status = await client9.getSystemStatus();
21347
21344
  if (status?.error !== undefined) {
21348
21345
  const err = status.error;
21349
- const cause = err?.code ? { code: err.code } : undefined;
21350
- throw Object.assign(new Error(err?.message ?? err?.code ?? "Unknown API error"), cause ? { cause } : {});
21346
+ const code = err?.cause?.code ?? err?.code;
21347
+ const cause = code ? { code } : undefined;
21348
+ const message = err?.cause?.message ?? err?.message ?? err?.code ?? "Unknown API error";
21349
+ throw Object.assign(new Error(message), cause ? { cause } : {});
21351
21350
  }
21352
21351
  const version = extractVersion(service, status) ?? "?";
21353
21352
  if (version === "?") {
@@ -21791,7 +21790,7 @@ init_dist();
21791
21790
  // package.json
21792
21791
  var package_default = {
21793
21792
  name: "tsarr",
21794
- version: "2.7.4",
21793
+ version: "2.7.5",
21795
21794
  author: "Robbe Verhelst",
21796
21795
  repository: {
21797
21796
  type: "git",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsarr",
3
- "version": "2.7.4",
3
+ "version": "2.7.5",
4
4
  "author": "Robbe Verhelst",
5
5
  "repository": {
6
6
  "type": "git",
Binary file