@forge/sql 2.2.0-next.3 → 2.2.1-next.0

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.
@@ -95,7 +95,7 @@ describe('SqlClient', () => {
95
95
  status: 400
96
96
  });
97
97
  mockFetch.mockResolvedValue(mockResponse);
98
- await expect(sqlClient.storageApi('INVALID SQL QUERY')).rejects.toThrow(new errors_1.ForgeSQLAPIError(mockResponse, forgeError));
98
+ await expect(sqlClient.storageApi('INVALID SQL QUERY')).rejects.toThrow(new errors_1.ForgeSQLAPIError({ status: mockResponse.status, statusText: mockResponse.statusText }, forgeError));
99
99
  });
100
100
  });
101
101
  describe('prepare', () => {
@@ -1,4 +1,5 @@
1
1
  export declare const errorCodes: {
2
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
2
3
  readonly SQL_EXECUTION_ERROR: "SQL_EXECUTION_ERROR";
3
4
  readonly INVALID_SQL_QUERY: "INVALID_SQL_QUERY";
4
5
  readonly QUERY_TIMED_OUT: "QUERY_TIMED_OUT";
@@ -1 +1 @@
1
- {"version":3,"file":"errorCodes.d.ts","sourceRoot":"","sources":["../src/errorCodes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;CAUb,CAAC"}
1
+ {"version":3,"file":"errorCodes.d.ts","sourceRoot":"","sources":["../src/errorCodes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;CAYb,CAAC"}
package/out/errorCodes.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.errorCodes = void 0;
4
4
  exports.errorCodes = {
5
+ UNKNOWN_ERROR: 'UNKNOWN_ERROR',
5
6
  SQL_EXECUTION_ERROR: 'SQL_EXECUTION_ERROR',
6
7
  INVALID_SQL_QUERY: 'INVALID_SQL_QUERY',
7
8
  QUERY_TIMED_OUT: 'QUERY_TIMED_OUT',
package/out/errors.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { APIResponse } from '@forge/api';
2
1
  export interface ForgeError {
3
2
  code: string;
4
3
  message: string;
@@ -8,23 +7,18 @@ export interface ForgeError {
8
7
  export declare class ForgeSQLError extends Error {
9
8
  constructor(message: string);
10
9
  }
11
- export interface APIErrorResponseDetails extends Pick<APIResponse, 'status' | 'statusText'> {
12
- traceId?: string | null;
13
- }
14
- export declare class ForgeSQLAPIUnknownError extends ForgeSQLError {
15
- code: string;
16
- responseText?: string;
10
+ export interface APIErrorResponseDetails {
17
11
  status: number;
18
12
  statusText: string;
19
13
  traceId?: string | null;
20
- constructor(responseDetails: APIErrorResponseDetails, body?: string, message?: string);
21
14
  }
22
- export declare class ForgeSQLAPIError extends ForgeSQLAPIUnknownError {
15
+ export declare class ForgeSQLAPIError extends ForgeSQLError {
16
+ responseDetails: APIErrorResponseDetails;
23
17
  code: string;
24
- serverMessage: string;
18
+ message: string;
25
19
  suggestion?: string;
26
20
  context?: Record<string, unknown>;
27
- constructor(responseDetails: APIErrorResponseDetails, forgeError: ForgeError, message?: string);
21
+ constructor(responseDetails: APIErrorResponseDetails, forgeError: ForgeError);
28
22
  }
29
23
  export declare class MigrationExecutionError extends ForgeSQLError {
30
24
  readonly migrationName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,WAAW,UAAU;IAKzB,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;IAGhB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAGnC;AAGD,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAMD,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,YAAY,CAAC;IAEzF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAOD,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,IAAI,SAAmB;IAGvB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,MAAM,EAAE,MAAM,CAAC;IAGf,UAAU,EAAE,MAAM,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEZ,eAAe,EAAE,uBAAuB,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAQtF;AAMD,qBAAa,gBAAiB,SAAQ,uBAAuB;IAK3D,IAAI,EAAE,MAAM,CAAC;IAEb,aAAa,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEtB,eAAe,EAAE,uBAAuB,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM;CAU/F;AAED,qBAAa,uBAAwB,SAAQ,aAAa;IAEtD,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC;AAED,qBAAa,wBAAyB,SAAQ,aAAa;IAEvD,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,UAAU;IAKzB,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;IAGhB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAGnC;AAGD,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AASD,MAAM,WAAW,uBAAuB;IAEtC,MAAM,EAAE,MAAM,CAAC;IAGf,UAAU,EAAE,MAAM,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAMD,qBAAa,gBAAiB,SAAQ,aAAa;IAMjD,eAAe,EAAE,uBAAuB,CAAC;IAMzC,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;IAGhB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEtB,eAAe,EAAE,uBAAuB,EAAE,UAAU,EAAE,UAAU;CAgB7E;AAED,qBAAa,uBAAwB,SAAQ,aAAa;IAEtD,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC;AAED,qBAAa,wBAAyB,SAAQ,aAAa;IAEvD,QAAQ,CAAC,aAAa,EAAE,MAAM;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE;gBAD5B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,EAAE;CAIxC"}
package/out/errors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MigrationCheckPointError = exports.MigrationExecutionError = exports.ForgeSQLAPIError = exports.ForgeSQLAPIUnknownError = exports.ForgeSQLError = void 0;
3
+ exports.MigrationCheckPointError = exports.MigrationExecutionError = exports.ForgeSQLAPIError = exports.ForgeSQLError = void 0;
4
4
  class ForgeSQLError extends Error {
5
5
  constructor(message) {
6
6
  super(message);
@@ -8,34 +8,21 @@ class ForgeSQLError extends Error {
8
8
  }
9
9
  }
10
10
  exports.ForgeSQLError = ForgeSQLError;
11
- class ForgeSQLAPIUnknownError extends ForgeSQLError {
12
- code = 'UNKNOWN_ERROR';
13
- responseText;
14
- status;
15
- statusText;
16
- traceId;
17
- constructor(responseDetails, body, message) {
18
- super(message || 'Unexpected error in Forge SQL API request');
19
- this.code = 'UNKNOWN_ERROR';
20
- this.status = responseDetails.status;
21
- this.statusText = responseDetails.statusText;
22
- this.traceId = responseDetails.traceId;
23
- this.responseText = body;
24
- }
25
- }
26
- exports.ForgeSQLAPIUnknownError = ForgeSQLAPIUnknownError;
27
- class ForgeSQLAPIError extends ForgeSQLAPIUnknownError {
11
+ class ForgeSQLAPIError extends ForgeSQLError {
12
+ responseDetails;
28
13
  code;
29
- serverMessage;
14
+ message;
30
15
  suggestion;
31
16
  context;
32
- constructor(responseDetails, forgeError, message) {
33
- super(responseDetails, undefined, message || forgeError.message);
34
- const { code, message: serverMessage, suggestion, context = {}, ...additionalData } = forgeError;
17
+ constructor(responseDetails, forgeError) {
18
+ super(forgeError.message);
19
+ const { status, statusText, traceId } = responseDetails;
20
+ this.responseDetails = { status, statusText, traceId };
21
+ const { code, message, suggestion, context = {}, ...bodyData } = forgeError;
35
22
  this.code = code;
36
- this.serverMessage = serverMessage;
23
+ this.message = message;
37
24
  this.suggestion = suggestion;
38
- this.context = { ...context, ...additionalData };
25
+ this.context = { ...context, ...bodyData };
39
26
  }
40
27
  }
41
28
  exports.ForgeSQLAPIError = ForgeSQLAPIError;
package/out/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { sql } from './sql';
2
2
  import { errorCodes } from './errorCodes';
3
- import { ForgeError, ForgeSQLAPIUnknownError, ForgeSQLAPIError } from './errors';
3
+ import { ForgeError, ForgeSQLAPIError } from './errors';
4
4
  import { migrationRunner } from './migration';
5
5
  import type { Result, UpdateQueryResponse } from './utils/types';
6
6
  export type { Result, UpdateQueryResponse };
7
- export { errorCodes, migrationRunner, sql, ForgeError, ForgeSQLAPIUnknownError, ForgeSQLAPIError };
7
+ export { errorCodes, migrationRunner, sql, ForgeError, ForgeSQLAPIError };
8
8
  export default sql;
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjE,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,CAAC;AAEnG,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjE,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;AAE1E,eAAe,GAAG,CAAC"}
package/out/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ForgeSQLAPIError = exports.ForgeSQLAPIUnknownError = exports.sql = exports.migrationRunner = exports.errorCodes = void 0;
3
+ exports.ForgeSQLAPIError = exports.sql = exports.migrationRunner = exports.errorCodes = void 0;
4
4
  const sql_1 = require("./sql");
5
5
  Object.defineProperty(exports, "sql", { enumerable: true, get: function () { return sql_1.sql; } });
6
6
  const errorCodes_1 = require("./errorCodes");
7
7
  Object.defineProperty(exports, "errorCodes", { enumerable: true, get: function () { return errorCodes_1.errorCodes; } });
8
8
  const errors_1 = require("./errors");
9
- Object.defineProperty(exports, "ForgeSQLAPIUnknownError", { enumerable: true, get: function () { return errors_1.ForgeSQLAPIUnknownError; } });
10
9
  Object.defineProperty(exports, "ForgeSQLAPIError", { enumerable: true, get: function () { return errors_1.ForgeSQLAPIError; } });
11
10
  const migration_1 = require("./migration");
12
11
  Object.defineProperty(exports, "migrationRunner", { enumerable: true, get: function () { return migration_1.migrationRunner; } });
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const node_fetch_1 = require("node-fetch");
4
+ const errorCodes_1 = require("../../errorCodes");
4
5
  const errors_1 = require("../../errors");
5
6
  const error_handling_1 = require("../error-handling");
6
7
  describe('errorFromResponse', () => {
@@ -29,35 +30,13 @@ describe('errorFromResponse', () => {
29
30
  catch (error) {
30
31
  expect(error).toBeInstanceOf(errors_1.ForgeSQLAPIError);
31
32
  expect(error).toMatchObject({
32
- status: 400,
33
- statusText: 'Bad Request',
34
- traceId,
33
+ responseDetails: {
34
+ status: 400,
35
+ statusText: 'Bad Request',
36
+ traceId
37
+ },
35
38
  code,
36
- message,
37
- serverMessage: message
38
- });
39
- }
40
- });
41
- it('should include custom message if provided', async () => {
42
- const customMessage = 'A custom message';
43
- const mockResponse = new node_fetch_1.Response(JSON.stringify({ code, message }), {
44
- status: 400,
45
- statusText: 'Bad Request',
46
- headers: { 'x-trace-id': traceId }
47
- });
48
- try {
49
- await (0, error_handling_1.checkResponseError)(mockResponse, customMessage);
50
- throw new Error('Expected error to be thrown');
51
- }
52
- catch (error) {
53
- expect(error).toBeInstanceOf(errors_1.ForgeSQLAPIError);
54
- expect(error).toMatchObject({
55
- status: 400,
56
- statusText: 'Bad Request',
57
- traceId,
58
- code,
59
- message: customMessage,
60
- serverMessage: message
39
+ message
61
40
  });
62
41
  }
63
42
  });
@@ -78,9 +57,11 @@ describe('errorFromResponse', () => {
78
57
  code,
79
58
  message,
80
59
  context,
81
- status: 400,
82
- statusText: 'Bad Request',
83
- traceId
60
+ responseDetails: {
61
+ status: 400,
62
+ statusText: 'Bad Request',
63
+ traceId
64
+ }
84
65
  });
85
66
  }
86
67
  });
@@ -101,9 +82,11 @@ describe('errorFromResponse', () => {
101
82
  code,
102
83
  message,
103
84
  context: extraFields,
104
- status: 400,
105
- statusText: 'Bad Request',
106
- traceId
85
+ responseDetails: {
86
+ status: 400,
87
+ statusText: 'Bad Request',
88
+ traceId
89
+ }
107
90
  });
108
91
  }
109
92
  });
@@ -125,9 +108,11 @@ describe('errorFromResponse', () => {
125
108
  code,
126
109
  message,
127
110
  context: { ...context, ...extraFields },
128
- status: 400,
129
- statusText: 'Bad Request',
130
- traceId
111
+ responseDetails: {
112
+ status: 400,
113
+ statusText: 'Bad Request',
114
+ traceId
115
+ }
131
116
  });
132
117
  }
133
118
  });
@@ -147,15 +132,17 @@ describe('errorFromResponse', () => {
147
132
  code,
148
133
  message,
149
134
  suggestion,
150
- status: 400,
151
- statusText: 'Bad Request',
152
- traceId
135
+ responseDetails: {
136
+ status: 400,
137
+ statusText: 'Bad Request',
138
+ traceId
139
+ }
153
140
  });
154
141
  }
155
142
  });
156
143
  });
157
- describe('Unknown or not forge errors - ForgeSQLAPIUnknownError', () => {
158
- it('returns an ForgeSQLAPIUnknownError when no response body', async () => {
144
+ describe('Handle non forge errors - UNKNOWN_ERROR', () => {
145
+ it('returns an when no response body', async () => {
159
146
  const mockResponse = new node_fetch_1.Response(undefined, {
160
147
  status: 404,
161
148
  statusText: 'Not Found',
@@ -166,16 +153,21 @@ describe('errorFromResponse', () => {
166
153
  throw new Error('Expected error to be thrown');
167
154
  }
168
155
  catch (error) {
169
- expect(error).toBeInstanceOf(errors_1.ForgeSQLAPIUnknownError);
156
+ expect(error).toBeInstanceOf(errors_1.ForgeSQLAPIError);
170
157
  expect(error).toMatchObject({
171
- code: 'UNKNOWN_ERROR',
172
- status: 404,
173
- statusText: 'Not Found',
174
- traceId
158
+ code: errorCodes_1.errorCodes.UNKNOWN_ERROR,
159
+ context: {
160
+ responseText: ''
161
+ },
162
+ responseDetails: {
163
+ traceId,
164
+ status: 404,
165
+ statusText: 'Not Found'
166
+ }
175
167
  });
176
168
  }
177
169
  });
178
- it("returns ForgeSQLAPIUnknownError if there is a JSON body that isn't a forge error", async () => {
170
+ it("returns UNKNOWN_ERROR if there is a JSON body that isn't a forge error", async () => {
179
171
  const body = JSON.stringify({ not: 'a forge error' });
180
172
  const mockResponse = new node_fetch_1.Response(body, {
181
173
  status: 500,
@@ -187,13 +179,17 @@ describe('errorFromResponse', () => {
187
179
  throw new Error('Expected error to be thrown');
188
180
  }
189
181
  catch (error) {
190
- expect(error).toBeInstanceOf(errors_1.ForgeSQLAPIUnknownError);
182
+ expect(error).toBeInstanceOf(errors_1.ForgeSQLAPIError);
191
183
  expect(error).toMatchObject({
192
- code: 'UNKNOWN_ERROR',
193
- status: 500,
194
- statusText: 'Internal Server Error',
195
- responseText: body,
196
- traceId
184
+ code: errorCodes_1.errorCodes.UNKNOWN_ERROR,
185
+ context: {
186
+ responseText: body
187
+ },
188
+ responseDetails: {
189
+ traceId,
190
+ status: 500,
191
+ statusText: 'Internal Server Error'
192
+ }
197
193
  });
198
194
  }
199
195
  });
@@ -1 +1 @@
1
- {"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/utils/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAA2B,UAAU,EAA6C,MAAM,WAAW,CAAC;AAG3G,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,UAAU,CAO9D;AASD,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC/F"}
1
+ {"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/utils/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAA2B,UAAU,EAAoB,MAAM,WAAW,CAAC;AAGlF,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,UAAU,CAO9D;AASD,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC/F"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkResponseError = exports.isForgeError = void 0;
4
+ const errorCodes_1 = require("../errorCodes");
4
5
  const errors_1 = require("../errors");
5
6
  function isForgeError(body) {
6
7
  if (typeof body === 'object' && body !== null) {
@@ -16,15 +17,16 @@ async function checkResponseError(response, message) {
16
17
  return;
17
18
  }
18
19
  const responseText = await response.text();
20
+ const traceId = response.headers.get('x-b3-traceid') || response.headers.get('x-trace-id');
19
21
  const details = {
20
22
  status: response.status,
21
23
  statusText: response.statusText,
22
- traceId: response.headers.get('x-trace-id')
24
+ traceId
23
25
  };
24
26
  try {
25
27
  const parsedBody = JSON.parse(responseText);
26
28
  if (isForgeError(parsedBody)) {
27
- throw new errors_1.ForgeSQLAPIError(details, parsedBody, message);
29
+ throw new errors_1.ForgeSQLAPIError(details, parsedBody);
28
30
  }
29
31
  }
30
32
  catch (error) {
@@ -34,6 +36,10 @@ async function checkResponseError(response, message) {
34
36
  throw error;
35
37
  }
36
38
  }
37
- throw new errors_1.ForgeSQLAPIUnknownError(details, responseText, message);
39
+ throw new errors_1.ForgeSQLAPIError(details, {
40
+ code: errorCodes_1.errorCodes.UNKNOWN_ERROR,
41
+ message: message || 'Unexpected error in Forge SQL API request',
42
+ context: { responseText }
43
+ });
38
44
  }
39
45
  exports.checkResponseError = checkResponseError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/sql",
3
- "version": "2.2.0-next.3",
3
+ "version": "2.2.1-next.0",
4
4
  "description": "Forge SQL sdk",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -22,6 +22,6 @@
22
22
  "jest-when": "^3.6.0"
23
23
  },
24
24
  "dependencies": {
25
- "@forge/api": "^4.1.0-next.0"
25
+ "@forge/api": "^4.1.0"
26
26
  }
27
27
  }