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.
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/types/errors/TriangleAPIError.d.ts +4 -0
- package/dist/src/types/errors/TriangleAPIError.js +19 -0
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/types/errors/{APIError.ts → TriangleAPIError.ts} +2 -2
- package/src/types/fragments/Fragment.ts +1 -1
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -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
package/src/index.ts
CHANGED
|
@@ -10,12 +10,12 @@ const default_messages_by_status : Record<number, string> = {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
export class
|
|
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 = "
|
|
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
|
|
3
|
+
import { WebArticleTag } from "../web/WebArticleTag"
|
|
4
4
|
import { ScoutDocument } from "../scout/ScoutDocument"
|
|
5
5
|
import { TwitterTweet } from "../twitter/TwitterTweet"
|
|
6
6
|
|