triangle-types 1.0.246 → 1.0.247

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,4 @@
1
- export * from "./types/errors/APIError.js";
1
+ export * from "./types/errors/TriangleAPIError.js";
2
2
  export * from "./types/application/ApplicationStage.js";
3
3
  export * from "./types/twitter/TwitterTweet.js";
4
4
  export * from "./types/twitter/TwitterUser.js";
package/dist/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./types/errors/APIError.js";
1
+ export * from "./types/errors/TriangleAPIError.js";
2
2
  export * from "./types/application/ApplicationStage.js";
3
3
  export * from "./types/twitter/TwitterTweet.js";
4
4
  export * from "./types/twitter/TwitterUser.js";
@@ -0,0 +1,4 @@
1
+ export declare class TriangleAPIError extends Error {
2
+ status: number;
3
+ constructor(status: number, message?: string);
4
+ }
@@ -0,0 +1,19 @@
1
+ const default_messages_by_status = {
2
+ 400: "Bad Request",
3
+ 401: "Unauthorized",
4
+ 403: "Forbidden",
5
+ 404: "Not Found",
6
+ 405: "Method Not Allowed",
7
+ 500: "Internal Server Error",
8
+ 504: "Gateway Timeout",
9
+ 600: "Failed to Parse Output"
10
+ };
11
+ export class TriangleAPIError extends Error {
12
+ status;
13
+ constructor(status, message) {
14
+ const default_message = default_messages_by_status[status];
15
+ super(message !== undefined ? message : default_message !== undefined ? default_message : "Error");
16
+ this.name = "TriangleAPIError";
17
+ this.status = status;
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.246",
3
+ "version": "1.0.247",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./types/errors/APIError"
1
+ export * from "./types/errors/TriangleAPIError"
2
2
 
3
3
  export * from "./types/application/ApplicationStage"
4
4
 
@@ -10,12 +10,12 @@ const default_messages_by_status : Record<number, string> = {
10
10
  }
11
11
 
12
12
 
13
- export class APIError extends Error {
13
+ export class TriangleAPIError extends Error {
14
14
  status : number
15
15
  constructor(status : number, message?: string) {
16
16
  const default_message = default_messages_by_status[status]
17
17
  super(message !== undefined ? message : default_message !== undefined ? default_message : "Error")
18
- this.name = "APIError"
18
+ this.name = "TriangleAPIError"
19
19
  this.status = status
20
20
  }
21
21
  }
@@ -1,6 +1,6 @@
1
1
  import { FederalCongressBillDocument } from "../federal_congress/FederalCongressBillDocument"
2
2
  import { LegistarDocument } from "../legistar/LegistarDocument"
3
- import { WebArticleTag, WebArticleTagAux } from "../web/WebArticleTag"
3
+ import { WebArticleTag } from "../web/WebArticleTag"
4
4
  import { ScoutDocument } from "../scout/ScoutDocument"
5
5
  import { TwitterTweet } from "../twitter/TwitterTweet"
6
6