1
1
export class InvalidEmailError extends Error {
2
- constructor ( public didYouMean : string ) {
3
- super ( ) ;
4
- this . didYouMean = didYouMean ;
2
+ constructor (
3
+ public didYouMean : string ,
4
+ options ?: ErrorOptions ,
5
+ ) {
6
+ super ( `Did you mean "${ didYouMean } " ?` , options ) ;
7
+ this . name = "InvalidEmailError" ;
5
8
}
6
9
}
7
10
8
11
export class ForbiddenError extends Error { }
9
12
10
13
export class UnableToAutoJoinOrganizationError extends Error {
11
- constructor ( public moderationId : number ) {
12
- super ( ) ;
13
- this . moderationId = moderationId ;
14
+ constructor (
15
+ public moderationId : number ,
16
+ options ?: ErrorOptions ,
17
+ ) {
18
+ super ( `Linked to moderation ${ moderationId } ` , options ) ;
19
+ this . name = "UnableToAutoJoinOrganizationError" ;
14
20
}
15
21
}
16
22
17
23
export class UserInOrganizationAlreadyError extends Error { }
18
24
19
25
export class UserAlreadyAskedToJoinOrganizationError extends Error {
20
- constructor ( public moderationId : number ) {
21
- super ( ) ;
22
- this . moderationId = moderationId ;
26
+ constructor (
27
+ public moderationId : number ,
28
+ options : ErrorOptions ,
29
+ ) {
30
+ super (
31
+ `Moderation ${ moderationId } already asked to join organization` ,
32
+ options ,
33
+ ) ;
34
+ this . name = "UserAlreadyAskedToJoinOrganizationError" ;
23
35
}
24
36
}
25
37
26
38
export class UserMustConfirmToJoinOrganizationError extends Error {
27
- constructor ( public organizationId : number ) {
28
- super ( ) ;
29
- this . organizationId = organizationId ;
39
+ constructor (
40
+ public organizationId : number ,
41
+ options ?: ErrorOptions ,
42
+ ) {
43
+ super ( `Organization ${ organizationId } confirmation is required` , options ) ;
44
+ this . name = "UserMustConfirmToJoinOrganizationError" ;
30
45
}
31
46
}
32
47
@@ -42,7 +57,7 @@ export class DomainRestrictedError extends Error {
42
57
public organizationId : number ,
43
58
options ?: ErrorOptions ,
44
59
) {
45
- super ( "" , options ) ;
60
+ super ( `Organization ${ organizationId } is domain restricted` , options ) ;
46
61
this . name = "DomainRestrictedError" ;
47
62
}
48
63
}
@@ -109,10 +124,10 @@ export class OidcError extends Error {
109
124
constructor (
110
125
public error : string ,
111
126
public error_description ?: string ,
127
+ options ?: ErrorOptions ,
112
128
) {
113
- super ( ) ;
114
- this . error = error ;
115
- this . error_description = error_description ;
129
+ super ( `${ error } : ${ error_description } ` , options ) ;
130
+ this . name = "OidcError" ;
116
131
}
117
132
}
118
133
0 commit comments