forked from ulid/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.ts
More file actions
24 lines (20 loc) · 718 Bytes
/
Copy patherror.ts
File metadata and controls
24 lines (20 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export enum ULIDErrorCode {
Base32IncorrectEncoding = "B32_ENC_INVALID",
DecodeTimeInvalidCharacter = "DEC_TIME_CHAR",
DecodeTimeValueMalformed = "DEC_TIME_MALFORMED",
EncodeTimeNegative = "ENC_TIME_NEG",
EncodeTimeSizeExceeded = "ENC_TIME_SIZE_EXCEED",
EncodeTimeValueMalformed = "ENC_TIME_MALFORMED",
PRNGDetectFailure = "PRNG_DETECT",
ULIDInvalid = "ULID_INVALID",
Unexpected = "UNEXPECTED",
UUIDInvalid = "UUID_INVALID"
}
export class ULIDError extends Error {
public code: ULIDErrorCode;
constructor(errorCode: ULIDErrorCode, message: string) {
super(`${message} (${errorCode})`);
this.name = "ULIDError";
this.code = errorCode;
}
}