@hexdspace/react 0.0.25 → 0.0.26

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/dist/index.d.ts CHANGED
@@ -177,7 +177,9 @@ interface GenericResponse {
177
177
  }
178
178
 
179
179
  interface ErrorResponse {
180
- error: string;
180
+ message: string;
181
+ status: number;
182
+ name: string;
181
183
  details?: unknown;
182
184
  }
183
185
 
package/dist/index.js CHANGED
@@ -524,7 +524,7 @@ var FetchHttpClient = class {
524
524
  const data = await (res.headers.get("content-type")?.includes("application/json") ? res.json() : res.text());
525
525
  if (!res.ok) {
526
526
  const errorResponse = data;
527
- const message = errorResponse?.error ?? res.statusText;
527
+ const message = errorResponse?.message ?? res.statusText;
528
528
  throw new HttpError(message, res.status, errorResponse);
529
529
  }
530
530
  return {
@@ -535,7 +535,11 @@ var FetchHttpClient = class {
535
535
  } catch (err) {
536
536
  if (err instanceof HttpError) throw err;
537
537
  const message = err instanceof Error ? err.message : "HTTP request failed";
538
- throw new HttpError(message, 0, { error: JSON.stringify(err) });
538
+ throw new HttpError(message, 0, {
539
+ name: "Error",
540
+ message: JSON.stringify(err),
541
+ status: 500
542
+ });
539
543
  }
540
544
  }
541
545
  resolve(url) {
@@ -550,7 +554,11 @@ async function refresh(httpClient2) {
550
554
  if (err instanceof HttpError) {
551
555
  return nok(err);
552
556
  } else {
553
- return nok(new HttpError("Unknown error during refresh", 0, { error: JSON.stringify(err) }));
557
+ return nok(new HttpError("Unknown error during refresh", 0, {
558
+ name: "Error",
559
+ message: JSON.stringify(err),
560
+ status: 500
561
+ }));
554
562
  }
555
563
  }
556
564
  }
@@ -872,7 +880,7 @@ function dispatchRegisterResult(res, dispatch) {
872
880
  }
873
881
  function getErrorMessage(error) {
874
882
  if (error instanceof HttpError) {
875
- return error.response.error ?? error.message;
883
+ return error.response.message;
876
884
  }
877
885
  return error.message;
878
886
  }
@@ -973,7 +981,7 @@ function httpResponse(data, status = 200) {
973
981
  return { data, status, headers: {} };
974
982
  }
975
983
  function unauthorized() {
976
- return new HttpError("Unauthorized", 401, { error: "Unauthorized" });
984
+ return new HttpError("Unauthorized", 401, { message: "Unauthorized", status: 401, name: "Unauthorized" });
977
985
  }
978
986
  var MockAuthHttpClient = class extends MockHttpClient {
979
987
  fixtures;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexdspace/react",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",