lemmy-js-client 0.19.11-donation-dialog.1 → 0.19.12-name-and-message.1

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.
Files changed (2) hide show
  1. package/dist/http.js +8 -3
  2. package/package.json +1 -1
package/dist/http.js CHANGED
@@ -919,7 +919,7 @@ _LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHtt
919
919
  return `${__classPrivateFieldGet(this, _LemmyHttp_apiUrl, "f")}${endpoint}`;
920
920
  }, _LemmyHttp_wrapper = function _LemmyHttp_wrapper(type_, endpoint, form) {
921
921
  return __awaiter(this, void 0, void 0, function* () {
922
- var _a;
922
+ var _a, _b;
923
923
  let response;
924
924
  if (type_ === HttpType.Get) {
925
925
  const getUrl = `${__classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_buildFullUrl).call(this, endpoint)}?${encodeGetParams(form)}`;
@@ -939,11 +939,16 @@ _LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHtt
939
939
  try {
940
940
  json = yield response.json();
941
941
  }
942
- catch (_b) {
942
+ catch (_c) {
943
943
  throw new Error(response.statusText);
944
944
  }
945
945
  if (!response.ok) {
946
- throw new Error((_a = json["error"]) !== null && _a !== void 0 ? _a : response.statusText);
946
+ let err = {
947
+ name: (_a = json.error) !== null && _a !== void 0 ? _a : response.statusText,
948
+ // Leave an empty error message if undefined
949
+ message: (_b = json.message) !== null && _b !== void 0 ? _b : "",
950
+ };
951
+ throw err;
947
952
  }
948
953
  else {
949
954
  return json;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
3
  "description": "A javascript / typescript client for Lemmy",
4
- "version": "0.19.11-donation-dialog.1",
4
+ "version": "0.19.12-name-and-message.1",
5
5
  "author": "Dessalines <tyhou13@gmx.com>",
6
6
  "license": "AGPL-3.0",
7
7
  "main": "./dist/index.js",