Skip to content

Commit 7083768

Browse files
committed
Fixed previous release
1 parent e23b4b1 commit 7083768

File tree

5 files changed

+39
-27
lines changed

5 files changed

+39
-27
lines changed

out/client/index.js

Lines changed: 18 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/client/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "websocketapi",
3-
"version": "1.1.13",
3+
"version": "1.1.14",
44
"description": "",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",

static/bundle.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ async function getData(id, api, body, options) {
257257
// compile an error based on the data and throw it
258258
const error = new Error(data.error.message);
259259
error.name = data.error.name;
260-
error.api = api;
261260
if (data.error.status) {
262261
error.status = data.error.status;
263262
}
@@ -298,7 +297,6 @@ async function sendData(id, api, body, options) {
298297
// compile an error based on the data and throw it
299298
const error = new Error(data.error.message);
300299
error.name = data.error.name;
301-
error.api = api;
302300
if (data.error.status) {
303301
error.status = data.error.status;
304302
}
@@ -328,16 +326,24 @@ async function fetch(api, body, options) {
328326
*/
329327
let id = newIndex();
330328
let method = options && options.method ? options.method : "GET";
331-
switch (method) {
332-
case "POST":
333-
return await sendData(id, api, body, options);
334-
case "PUT":
335-
return await sendData(id, api, body, options);
336-
case "DELETE":
337-
return await getData(id, api, body, options);
338-
case "GET":
339-
default:
340-
return await getData(id, api, body, options);
329+
try {
330+
switch (method) {
331+
case "POST":
332+
return await sendData(id, api, body, options);
333+
case "PUT":
334+
return await sendData(id, api, body, options);
335+
case "DELETE":
336+
return await getData(id, api, body, options);
337+
case "GET":
338+
default:
339+
return await getData(id, api, body, options);
340+
}
341+
}
342+
catch (err) {
343+
if (err instanceof Error) {
344+
err.api = api;
345+
}
346+
throw err;
341347
}
342348
}
343349
/**

0 commit comments

Comments
 (0)