-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.ts
More file actions
40 lines (35 loc) · 1000 Bytes
/
errors.ts
File metadata and controls
40 lines (35 loc) · 1000 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
export class AuthKitError extends Error {
data?: Record<string, any>;
constructor(message: string, cause?: unknown, data?: Record<string, any>) {
super(message);
this.name = 'AuthKitError';
this.cause = cause;
this.data = data;
}
}
export class SessionEncryptionError extends AuthKitError {
constructor(message: string, cause?: unknown) {
super(message, cause);
this.name = 'SessionEncryptionError';
}
}
export class TokenValidationError extends AuthKitError {
constructor(message: string, cause?: unknown) {
super(message, cause);
this.name = 'TokenValidationError';
}
}
export class TokenRefreshError extends AuthKitError {
readonly userId?: string;
readonly sessionId?: string;
constructor(
message: string,
cause?: unknown,
context?: { userId?: string; sessionId?: string },
) {
super(message, cause);
this.name = 'TokenRefreshError';
this.userId = context?.userId;
this.sessionId = context?.sessionId;
}
}