@swell/cli 2.0.1-alpha.8 → 2.0.1-alpha.9

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.
@@ -47,7 +47,7 @@ it will output all versions of the app instead.`;
47
47
  const spinner = ora();
48
48
  spinner.start('Retrieving app info...');
49
49
  this.app = await this.getAppWithConfig().catch((error) => {
50
- spinner.fail(`Error fetching app info: ${JSON.stringify(this.app)}`);
50
+ spinner.fail(`Error fetching app info:`);
51
51
  throw error;
52
52
  });
53
53
  if (spinner.isSpinning) {
package/dist/lib/api.js CHANGED
@@ -65,8 +65,17 @@ export default class Api {
65
65
  throw new Error('Operation not supported.');
66
66
  const resp = await fetch(path, fetchOptions);
67
67
  const respData = await resp.text();
68
- if (!resp.ok)
69
- throw new Error(respData);
68
+ if (!resp.ok) {
69
+ // Try to parse error message
70
+ let errorJson;
71
+ try {
72
+ errorJson = JSON.parse(respData);
73
+ }
74
+ catch {
75
+ // ignore
76
+ }
77
+ throw new Error(errorJson?.error?.message || errorJson?.error || respData);
78
+ }
70
79
  try {
71
80
  return JSON.parse(respData);
72
81
  }
@@ -1086,5 +1086,5 @@
1086
1086
  ]
1087
1087
  }
1088
1088
  },
1089
- "version": "2.0.1-alpha.8"
1089
+ "version": "2.0.1-alpha.9"
1090
1090
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swell/cli",
3
- "version": "2.0.1-alpha.8",
3
+ "version": "2.0.1-alpha.9",
4
4
  "type": "module",
5
5
  "description": "Swell's command line interface/utility",
6
6
  "keywords": [