rlz-engine 1.0.29 → 1.0.31

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.
@@ -1,4 +1,7 @@
1
1
  import z, { ZodType } from 'zod';
2
+ export declare class Unauthorized extends Error {
3
+ constructor(url: string);
4
+ }
2
5
  export declare class Forbidden extends Error {
3
6
  constructor(url: string);
4
7
  }
@@ -1,4 +1,9 @@
1
1
  import { getFrontConfig } from '../config';
2
+ export class Unauthorized extends Error {
3
+ constructor(url) {
4
+ super(`Unauthorized: ${url}`);
5
+ }
6
+ }
2
7
  export class Forbidden extends Error {
3
8
  constructor(url) {
4
9
  super(`Forbidden: ${url}`);
@@ -44,6 +49,9 @@ export async function apiCall(method, version, path, auth, queryString, request,
44
49
  body
45
50
  });
46
51
  if (!resp.ok) {
52
+ if (resp.status === 401) {
53
+ throw new Unauthorized(u);
54
+ }
47
55
  if (resp.status === 403) {
48
56
  throw new Forbidden(u);
49
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rlz-engine",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Deps and tools for my style of development",
5
5
  "scripts": {
6
6
  "build": "tsc",