shelving 1.134.0 → 1.134.1
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/error/CodedError.d.ts +3 -1
- package/error/CodedError.js +4 -1
- package/error/ConflictError.js +2 -1
- package/error/ConnectionError.js +2 -1
- package/error/ForbiddenError.js +2 -1
- package/error/NotFoundError.js +2 -1
- package/error/NotImplementedError.js +2 -1
- package/error/UnauthorizedError.js +2 -1
- package/error/ValidationError.js +2 -1
- package/package.json +1 -1
package/error/CodedError.d.ts
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* - Details are converted to string using `debug()`
|
|
6
6
|
*/
|
|
7
7
|
export declare class CodedError extends Error {
|
|
8
|
+
/** Number in the range of 400-599, roughly corresponding to HTTP error codes. */
|
|
8
9
|
readonly code: number;
|
|
10
|
+
/** Details about the error, which are appended to the message. */
|
|
9
11
|
readonly details: unknown;
|
|
10
|
-
constructor(message
|
|
12
|
+
constructor(message?: string, details?: unknown);
|
|
11
13
|
}
|
package/error/CodedError.js
CHANGED
|
@@ -6,9 +6,11 @@ import { debug } from "../util/debug.js";
|
|
|
6
6
|
* - Details are converted to string using `debug()`
|
|
7
7
|
*/
|
|
8
8
|
export class CodedError extends Error {
|
|
9
|
+
/** Number in the range of 400-599, roughly corresponding to HTTP error codes. */
|
|
9
10
|
code = 500;
|
|
11
|
+
/** Details about the error, which are appended to the message. */
|
|
10
12
|
details;
|
|
11
|
-
constructor(message, details) {
|
|
13
|
+
constructor(message = CodedError.prototype.message, details) {
|
|
12
14
|
const debugged = details !== undefined ? debug(details, 2) : "";
|
|
13
15
|
super(debugged.length ? `${message}: ${debugged}` : message);
|
|
14
16
|
this.details = details;
|
|
@@ -16,3 +18,4 @@ export class CodedError extends Error {
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
CodedError.prototype.name = "CodedError";
|
|
21
|
+
CodedError.prototype.message = "Internal error";
|
package/error/ConflictError.js
CHANGED
|
@@ -2,9 +2,10 @@ import { CodedError } from "./CodedError.js";
|
|
|
2
2
|
/** Thrown if the state of the program is not correct to execute a given operation. */
|
|
3
3
|
export class ConflictError extends CodedError {
|
|
4
4
|
code = 509;
|
|
5
|
-
constructor(message =
|
|
5
|
+
constructor(message = ConflictError.prototype.message, context) {
|
|
6
6
|
super(message, context);
|
|
7
7
|
Error.captureStackTrace(this, ConflictError);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
ConflictError.prototype.name = "ConflictError";
|
|
11
|
+
ConflictError.prototype.message = "Conflict";
|
package/error/ConnectionError.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CodedError } from "./CodedError.js";
|
|
2
2
|
/** Thrown if e.g. a user's internet connection fails. */
|
|
3
3
|
export class ConnectionError extends CodedError {
|
|
4
|
-
constructor(message =
|
|
4
|
+
constructor(message = ConnectionError.prototype.message, context) {
|
|
5
5
|
super(message, context);
|
|
6
6
|
Error.captureStackTrace(this, ConnectionError);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
ConnectionError.prototype.name = "ConnectionError";
|
|
10
|
+
ConnectionError.prototype.message = "Connection error";
|
package/error/ForbiddenError.js
CHANGED
|
@@ -2,9 +2,10 @@ import { CodedError } from "./CodedError.js";
|
|
|
2
2
|
/** Thrown if an operation failed because the user is logged in but does not have sufficient privileges to access something. */
|
|
3
3
|
export class ForbiddenError extends CodedError {
|
|
4
4
|
code = 403;
|
|
5
|
-
constructor(message =
|
|
5
|
+
constructor(message = ForbiddenError.prototype.message, context) {
|
|
6
6
|
super(message, context);
|
|
7
7
|
Error.captureStackTrace(this, ForbiddenError);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
ForbiddenError.prototype.name = "ForbiddenError";
|
|
11
|
+
ForbiddenError.prototype.message = "Forbidden";
|
package/error/NotFoundError.js
CHANGED
|
@@ -2,9 +2,10 @@ import { CodedError } from "./CodedError.js";
|
|
|
2
2
|
/** Thrown if if a value is required but doesn't exist. */
|
|
3
3
|
export class NotFoundError extends CodedError {
|
|
4
4
|
code = 404;
|
|
5
|
-
constructor(message =
|
|
5
|
+
constructor(message = NotFoundError.prototype.message, context) {
|
|
6
6
|
super(message, context);
|
|
7
7
|
Error.captureStackTrace(this, NotFoundError);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
NotFoundError.prototype.name = "NotFoundError";
|
|
11
|
+
NotFoundError.prototype.message = "Not found";
|
|
@@ -2,9 +2,10 @@ import { CodedError } from "./CodedError.js";
|
|
|
2
2
|
/** Error thrown when functionality is called but is not implemented by an interface. */
|
|
3
3
|
export class NotImplementedError extends CodedError {
|
|
4
4
|
code = 501;
|
|
5
|
-
constructor(message =
|
|
5
|
+
constructor(message = NotImplementedError.prototype.message, value) {
|
|
6
6
|
super(message, value);
|
|
7
7
|
Error.captureStackTrace(this, NotImplementedError);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
NotImplementedError.prototype.name = "NotImplementedError";
|
|
11
|
+
NotImplementedError.prototype.message = "Not implemented";
|
|
@@ -2,9 +2,10 @@ import { CodedError } from "./CodedError.js";
|
|
|
2
2
|
/** Thrown if an operation failed because the user is logged in but does not have sufficient privileges to access something. */
|
|
3
3
|
export class UnauthorizedError extends CodedError {
|
|
4
4
|
code = 401;
|
|
5
|
-
constructor(message =
|
|
5
|
+
constructor(message = UnauthorizedError.prototype.message, context) {
|
|
6
6
|
super(message, context);
|
|
7
7
|
Error.captureStackTrace(this, UnauthorizedError);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
UnauthorizedError.prototype.name = "UnauthorizedError";
|
|
11
|
+
UnauthorizedError.prototype.message = "Unauthorized";
|
package/error/ValidationError.js
CHANGED
|
@@ -2,9 +2,10 @@ import { CodedError } from "./CodedError.js";
|
|
|
2
2
|
/** Error thrown when a value isn't valid. */
|
|
3
3
|
export class ValidationError extends CodedError {
|
|
4
4
|
code = 422;
|
|
5
|
-
constructor(message =
|
|
5
|
+
constructor(message = ValidationError.prototype.message, context) {
|
|
6
6
|
super(message, context);
|
|
7
7
|
Error.captureStackTrace(this, ValidationError);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
ValidationError.prototype.name = "ValidationError";
|
|
11
|
+
ValidationError.prototype.message = "Invalid input";
|