tsarr 2.7.3 → 2.7.4

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/cli/index.js CHANGED
@@ -5525,12 +5525,39 @@ Run \`tsarr doctor\` to diagnose.`);
5525
5525
  } else if (error instanceof TsarrError) {
5526
5526
  consola.error(`Error: ${error.message}`);
5527
5527
  } else if (error instanceof Error) {
5528
- consola.error(error.message);
5528
+ const networkMsg = classifyNetworkError(error, serviceName);
5529
+ if (networkMsg) {
5530
+ consola.error(`${networkMsg}
5531
+ Run \`tsarr doctor\` to diagnose.`);
5532
+ } else {
5533
+ consola.error(error.message);
5534
+ }
5529
5535
  } else {
5530
5536
  consola.error("An unexpected error occurred.");
5531
5537
  }
5532
5538
  process.exit(1);
5533
5539
  }
5540
+ function classifyNetworkError(error, serviceName) {
5541
+ const cause = error.cause;
5542
+ const code = cause?.code ?? error.code;
5543
+ const msg = error.message;
5544
+ if (code === "ECONNREFUSED" || code === "ConnectionRefused") {
5545
+ return `Connection refused. Is ${serviceName} running?`;
5546
+ }
5547
+ if (code === "ENOTFOUND") {
5548
+ return `Host not found for ${serviceName}. Check the URL.`;
5549
+ }
5550
+ if (code === "ECONNRESET" || code === "ConnectionReset") {
5551
+ return `Connection reset. ${serviceName} may have crashed.`;
5552
+ }
5553
+ if (code === "ETIMEDOUT") {
5554
+ return `Connection timed out for ${serviceName}.`;
5555
+ }
5556
+ if (msg === "fetch failed" || msg.includes("fetch failed")) {
5557
+ return `Unable to reach ${serviceName}${cause?.message ? `: ${cause.message}` : ""}`;
5558
+ }
5559
+ return null;
5560
+ }
5534
5561
  var COMMAND_OUTPUT_COLUMNS;
5535
5562
  var init_service = __esm(() => {
5536
5563
  init_dist();
@@ -21764,7 +21791,7 @@ init_dist();
21764
21791
  // package.json
21765
21792
  var package_default = {
21766
21793
  name: "tsarr",
21767
- version: "2.7.3",
21794
+ version: "2.7.4",
21768
21795
  author: "Robbe Verhelst",
21769
21796
  repository: {
21770
21797
  type: "git",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsarr",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
4
4
  "author": "Robbe Verhelst",
5
5
  "repository": {
6
6
  "type": "git",
Binary file