@forge/sql 0.0.1-experimental-c8ed390 → 0.0.1-experimental-c15a11f
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/out/sql.js +1 -1
- package/out/utils/__test__/response-handler.test.js +1 -2
- package/out/utils/response-handler.d.ts +2 -2
- package/out/utils/response-handler.d.ts.map +1 -1
- package/out/utils/response-handler.js +4 -4
- package/out/utils/types.d.ts +1 -1
- package/out/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
package/out/sql.js
CHANGED
|
@@ -51,11 +51,10 @@ describe('getResponseBody', () => {
|
|
|
51
51
|
});
|
|
52
52
|
describe('ApiError', () => {
|
|
53
53
|
it('should create an ApiError with correct properties', () => {
|
|
54
|
-
const error = new response_handler_1.ApiError(404, 'NOT_FOUND', 'Resource not found'
|
|
54
|
+
const error = new response_handler_1.ApiError(404, 'NOT_FOUND', 'Resource not found');
|
|
55
55
|
expect(error).toBeInstanceOf(Error);
|
|
56
56
|
expect(error.status).toBe(404);
|
|
57
57
|
expect(error.code).toBe('NOT_FOUND');
|
|
58
58
|
expect(error.message).toBe('Resource not found');
|
|
59
|
-
expect(error.data).toEqual({ resource: 'User' });
|
|
60
59
|
});
|
|
61
60
|
});
|
|
@@ -2,8 +2,8 @@ import { Response, Result } from './types';
|
|
|
2
2
|
export declare class ApiError extends Error {
|
|
3
3
|
readonly status: number;
|
|
4
4
|
readonly code: string;
|
|
5
|
-
readonly
|
|
6
|
-
constructor(status: number, code: string, message: string,
|
|
5
|
+
readonly suggestion?: string | undefined;
|
|
6
|
+
constructor(status: number, code: string, message: string, suggestion?: string | undefined);
|
|
7
7
|
}
|
|
8
8
|
export declare function getResponseBody(response: Response): Promise<Result>;
|
|
9
9
|
//# sourceMappingURL=response-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-handler.d.ts","sourceRoot":"","sources":["../../src/utils/response-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"response-handler.d.ts","sourceRoot":"","sources":["../../src/utils/response-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,UAAU,CAAC;gBAHX,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,UAAU,CAAC,oBAAQ;CAI/B;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BzE"}
|
|
@@ -4,12 +4,12 @@ exports.getResponseBody = exports.ApiError = void 0;
|
|
|
4
4
|
class ApiError extends Error {
|
|
5
5
|
status;
|
|
6
6
|
code;
|
|
7
|
-
|
|
8
|
-
constructor(status, code, message,
|
|
7
|
+
suggestion;
|
|
8
|
+
constructor(status, code, message, suggestion) {
|
|
9
9
|
super(message);
|
|
10
10
|
this.status = status;
|
|
11
11
|
this.code = code;
|
|
12
|
-
this.
|
|
12
|
+
this.suggestion = suggestion;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.ApiError = ApiError;
|
|
@@ -18,7 +18,7 @@ async function getResponseBody(response) {
|
|
|
18
18
|
if (!response.ok) {
|
|
19
19
|
try {
|
|
20
20
|
const parsedError = JSON.parse(responseText);
|
|
21
|
-
throw new ApiError(response.status, parsedError?.error?.code, parsedError?.error?.
|
|
21
|
+
throw new ApiError(response.status, parsedError?.error?.code, parsedError?.error?.message, parsedError?.error?.suggestion);
|
|
22
22
|
}
|
|
23
23
|
catch (e) {
|
|
24
24
|
if (!(e instanceof ApiError)) {
|
package/out/utils/types.d.ts
CHANGED
package/out/utils/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,oBAAY,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;AAEnE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,oBAAY,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;AAEnE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/sql",
|
|
3
|
-
"version": "0.0.1-experimental-
|
|
3
|
+
"version": "0.0.1-experimental-c15a11f",
|
|
4
4
|
"description": "Forge SQL package",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"node-fetch": "2.7.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@forge/api": "^3.9.1-experimental-
|
|
24
|
+
"@forge/api": "^3.9.1-experimental-c15a11f"
|
|
25
25
|
}
|
|
26
26
|
}
|