disgroove 2.2.2-dev.23938d8 → 2.2.2-dev.bd3875c

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.
@@ -4,15 +4,15 @@ export declare class RESTError extends Error {
4
4
  method: string;
5
5
  endpoint: string;
6
6
  constructor(code: JSONErrorCodes, message: string, errors: Record<string, unknown>, method: string, endpoint: string);
7
- flattenErrors(errors: Record<string, unknown> | undefined, prefix?: string): string;
7
+ static flattenErrors(errors: Record<string, unknown> | undefined, prefix?: string): string;
8
8
  }
9
9
  export declare class HTTPError extends Error {
10
10
  name: string;
11
11
  method: string;
12
12
  endpoint: string;
13
- constructor(status: number, statusText: string, method: string, endpoint: string);
13
+ constructor(status: number, statusText: string, errors: Record<string, unknown>, method: string, endpoint: string);
14
14
  }
15
15
  export declare class GatewayError extends Error {
16
16
  name: string;
17
- constructor(message: string);
17
+ constructor(code: number, reason: string);
18
18
  }
@@ -6,12 +6,11 @@ class RESTError extends Error {
6
6
  method;
7
7
  endpoint;
8
8
  constructor(code, message, errors, method, endpoint) {
9
- super();
9
+ super(`[${code}] ${message}\n${RESTError.flattenErrors(errors)}`);
10
10
  this.method = method;
11
11
  this.endpoint = endpoint;
12
- this.message = `[${code}] ${message}\n${this.flattenErrors(errors)}`;
13
12
  }
14
- flattenErrors(errors, prefix = "") {
13
+ static flattenErrors(errors, prefix = "") {
15
14
  let result = "";
16
15
  if (errors) {
17
16
  for (const [key, value] of Object.entries(errors)) {
@@ -39,18 +38,17 @@ class HTTPError extends Error {
39
38
  name = "HTTPError";
40
39
  method;
41
40
  endpoint;
42
- constructor(status, statusText, method, endpoint) {
43
- super();
41
+ constructor(status, statusText, errors, method, endpoint) {
42
+ super(`[${status}] ${statusText}\n${RESTError.flattenErrors(errors)}`);
44
43
  this.method = method;
45
44
  this.endpoint = endpoint;
46
- this.message = `[${status}] ${statusText}`;
47
45
  }
48
46
  }
49
47
  exports.HTTPError = HTTPError;
50
48
  class GatewayError extends Error {
51
49
  name = "GatewayError";
52
- constructor(message) {
53
- super(message);
50
+ constructor(code, reason) {
51
+ super(`[${code}] ${reason}`);
54
52
  }
55
53
  }
56
54
  exports.GatewayError = GatewayError;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.2-dev.23938d8",
3
+ "version": "2.2.2-dev.bd3875c",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.2-dev.23938d8",
3
+ "version": "2.2.2-dev.bd3875c",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",