because I got bored of customising my CV for every job
1import { DomainError } from "@cv/system";
2
3export abstract class AuthenticationError extends DomainError {}
4
5export class NoTokenError extends AuthenticationError {
6 constructor() {
7 super("AUTHENTICATION_NO_TOKEN", "No authentication token provided");
8 }
9}
10
11export class InvalidCredentialsError extends AuthenticationError {
12 constructor() {
13 super("AUTHENTICATION_INVALID_CREDENTIALS", "Invalid credentials");
14 }
15}
16
17export class InvalidTokenError extends AuthenticationError {
18 constructor() {
19 super("AUTHENTICATION_INVALID_TOKEN", "Invalid token");
20 }
21}
22
23export class TokenExpiredError extends AuthenticationError {
24 constructor() {
25 super("AUTHENTICATION_TOKEN_EXPIRED", "Token expired");
26 }
27}
28
29export class InvalidRefreshTokenError extends AuthenticationError {
30 constructor() {
31 super(
32 "AUTHENTICATION_INVALID_REFRESH_TOKEN",
33 "Invalid or expired refresh token",
34 );
35 }
36}
37
38export class CurrentPasswordIncorrectError extends AuthenticationError {
39 constructor() {
40 super(
41 "AUTHENTICATION_CURRENT_PASSWORD_INCORRECT",
42 "Current password is incorrect",
43 );
44 }
45}
46
47export class PasswordIncorrectError extends AuthenticationError {
48 constructor() {
49 super("AUTHENTICATION_PASSWORD_INCORRECT", "Password is incorrect");
50 }
51}
52
53export class EmailAlreadyVerifiedError extends AuthenticationError {
54 constructor() {
55 super("AUTHENTICATION_EMAIL_ALREADY_VERIFIED", "Email is already verified");
56 }
57}
58
59export class InvalidVerificationTokenError extends AuthenticationError {
60 constructor() {
61 super(
62 "AUTHENTICATION_INVALID_VERIFICATION_TOKEN",
63 "Invalid verification token",
64 );
65 }
66}
67
68export class VerificationTokenExpiredError extends AuthenticationError {
69 constructor() {
70 super(
71 "AUTHENTICATION_VERIFICATION_TOKEN_EXPIRED",
72 "Verification token has expired",
73 );
74 }
75}
76
77export class InvalidPasswordResetTokenError extends AuthenticationError {
78 constructor() {
79 super(
80 "AUTHENTICATION_INVALID_PASSWORD_RESET_TOKEN",
81 "Invalid password reset token",
82 );
83 }
84}
85
86export class PasswordResetTokenExpiredError extends AuthenticationError {
87 constructor() {
88 super(
89 "AUTHENTICATION_PASSWORD_RESET_TOKEN_EXPIRED",
90 "Password reset token has expired",
91 );
92 }
93}
94
95export class EmailNotVerifiedError extends AuthenticationError {
96 constructor() {
97 super(
98 "AUTHENTICATION_EMAIL_NOT_VERIFIED",
99 "Email address has not been verified",
100 );
101 }
102}