6
6
* @constructor
7
7
*/
8
8
export class JwtError extends Error {
9
- constructor ( readonly code : JwtErrorCode , readonly message : string ) {
9
+ constructor (
10
+ readonly code : JwtErrorCode ,
11
+ readonly message : string
12
+ ) {
10
13
super ( message ) ;
11
- ( this as any ) . __proto__ = JwtError . prototype ;
14
+ ( this as any ) . __proto__ = JwtError . prototype
12
15
}
13
16
}
14
17
@@ -29,7 +32,7 @@ export enum JwtErrorCode {
29
32
* App client error codes and their default messages.
30
33
*/
31
34
export class AppErrorCodes {
32
- public static INVALID_CREDENTIAL = 'invalid-credential' ;
35
+ public static INVALID_CREDENTIAL = 'invalid-credential'
33
36
}
34
37
35
38
/**
@@ -39,31 +42,31 @@ export class AuthClientErrorCode {
39
42
public static INVALID_ARGUMENT = {
40
43
code : 'argument-error' ,
41
44
message : 'Invalid argument provided.' ,
42
- } ;
45
+ }
43
46
public static INVALID_CREDENTIAL = {
44
47
code : 'invalid-credential' ,
45
48
message : 'Invalid credential object provided.' ,
46
- } ;
49
+ }
47
50
public static ID_TOKEN_EXPIRED = {
48
51
code : 'id-token-expired' ,
49
52
message : 'The provided Firebase ID token is expired.' ,
50
- } ;
53
+ }
51
54
public static ID_TOKEN_REVOKED = {
52
55
code : 'id-token-revoked' ,
53
56
message : 'The Firebase ID token has been revoked.' ,
54
- } ;
57
+ }
55
58
public static INTERNAL_ERROR = {
56
59
code : 'internal-error' ,
57
60
message : 'An internal error has occurred.' ,
58
- } ;
61
+ }
59
62
public static USER_NOT_FOUND = {
60
63
code : 'user-not-found' ,
61
64
message : 'There is no user record corresponding to the provided identifier.' ,
62
- } ;
65
+ }
63
66
public static USER_DISABLED = {
64
67
code : 'user-disabled' ,
65
68
message : 'The user record is disabled.' ,
66
- } ;
69
+ }
67
70
}
68
71
69
72
/**
@@ -121,25 +124,25 @@ export class FirebaseError extends Error implements FirebaseErrorInterface {
121
124
// Set the prototype explicitly. See the following link for more details:
122
125
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
123
126
/* tslint:enable:max-line-length */
124
- ( this as any ) . __proto__ = FirebaseError . prototype ;
127
+ ( this as any ) . __proto__ = FirebaseError . prototype
125
128
}
126
129
127
130
/** @returns The error code. */
128
131
public get code ( ) : string {
129
- return this . errorInfo . code ;
132
+ return this . errorInfo . code
130
133
}
131
134
132
135
/** @returns The error message. */
133
136
public get message ( ) : string {
134
- return this . errorInfo . message ;
137
+ return this . errorInfo . message
135
138
}
136
139
137
140
/** @returns The object representation of the error. */
138
141
public toJSON ( ) : object {
139
142
return {
140
143
code : this . code ,
141
144
message : this . message ,
142
- } ;
145
+ }
143
146
}
144
147
}
145
148
@@ -160,7 +163,11 @@ export interface ErrorInfo {
160
163
* @constructor
161
164
*/
162
165
export class PrefixedFirebaseError extends FirebaseError {
163
- constructor ( private codePrefix : string , code : string , message : string ) {
166
+ constructor (
167
+ private codePrefix : string ,
168
+ code : string ,
169
+ message : string
170
+ ) {
164
171
super ( {
165
172
code : `${ codePrefix } /${ code } ` ,
166
173
message,
@@ -170,7 +177,7 @@ export class PrefixedFirebaseError extends FirebaseError {
170
177
// Set the prototype explicitly. See the following link for more details:
171
178
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
172
179
/* tslint:enable:max-line-length */
173
- ( this as any ) . __proto__ = PrefixedFirebaseError . prototype ;
180
+ ( this as any ) . __proto__ = PrefixedFirebaseError . prototype
174
181
}
175
182
176
183
/**
@@ -181,7 +188,7 @@ export class PrefixedFirebaseError extends FirebaseError {
181
188
* @returns True if the code matches, false otherwise.
182
189
*/
183
190
public hasCode ( code : string ) : boolean {
184
- return `${ this . codePrefix } /${ code } ` === this . code ;
191
+ return `${ this . codePrefix } /${ code } ` === this . code
185
192
}
186
193
}
187
194
@@ -202,6 +209,6 @@ export class FirebaseAuthError extends PrefixedFirebaseError {
202
209
// Set the prototype explicitly. See the following link for more details:
203
210
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
204
211
/* tslint:enable:max-line-length */
205
- ( this as any ) . __proto__ = FirebaseAuthError . prototype ;
212
+ ( this as any ) . __proto__ = FirebaseAuthError . prototype
206
213
}
207
214
}
0 commit comments