@lightdash/cli 0.2024.2 → 0.2024.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.
@@ -22,10 +22,17 @@ const lightdashApi = async ({ method, url, body, }) => {
22
22
  return (0, node_fetch_1.default)(fullUrl, { method, headers, body })
23
23
  .then((r) => {
24
24
  globalState_1.default.debug(`> HTTP request returned status: ${r.status}`);
25
- if (!r.ok)
26
- return r.json().then((d) => {
27
- throw new common_1.LightdashError(d.error);
25
+ if (!r.ok) {
26
+ const contentType = r.headers.get('content-type');
27
+ if (contentType && contentType.includes('application/json')) {
28
+ return r.json().then((d) => {
29
+ throw new common_1.LightdashError(d.error);
30
+ });
31
+ }
32
+ return r.text().then((text) => {
33
+ throw new Error(`Received non-JSON response from server (status ${r.status}): ${text}`);
28
34
  });
35
+ }
29
36
  return r;
30
37
  })
31
38
  .then((r) => r.json())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.2024.2",
3
+ "version": "0.2024.4",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "lightdash": "dist/index.js"
@@ -32,8 +32,8 @@
32
32
  "parse-node-version": "^2.0.0",
33
33
  "unique-names-generator": "^4.7.1",
34
34
  "uuid": "^11.0.3",
35
- "@lightdash/common": "0.2024.2",
36
- "@lightdash/warehouses": "0.2024.2"
35
+ "@lightdash/common": "0.2024.4",
36
+ "@lightdash/warehouses": "0.2024.4"
37
37
  },
38
38
  "description": "Lightdash CLI tool",
39
39
  "devDependencies": {