@@ -41,27 +41,37 @@ export function LoginForm() {
41
41
description : "Login Failed." ,
42
42
} ) ;
43
43
}
44
- } catch ( err : any ) {
45
- let description_text = "" ;
46
- switch ( err . message ) {
47
- case "Email and/or password is missing." :
48
- description_text = "Please provide both email and password." ;
49
- break ;
50
- case "Invalid email or password." :
51
- description_text = "Username or password is incorrect." ;
52
- break ;
53
- case "Internal server error. Please try again later." :
54
- description_text = "There was an issue with the server. Please try again later." ;
55
- break ;
56
- default :
57
- description_text = "An unexpected error occurred. Please try again." ;
58
- break ;
44
+ } catch ( err : unknown ) {
45
+ if ( err instanceof Error ) {
46
+ let description_text = "" ;
47
+ switch ( err . message ) {
48
+ case "Email and/or password is missing." :
49
+ description_text = "Please provide both email and password." ;
50
+ break ;
51
+ case "Invalid email or password." :
52
+ description_text = "Username or password is incorrect." ;
53
+ break ;
54
+ case "Internal server error. Please try again later." :
55
+ description_text =
56
+ "There was an issue with the server. Please try again later." ;
57
+ break ;
58
+ default :
59
+ description_text =
60
+ "An unexpected error occurred. Please try again." ;
61
+ break ;
62
+ }
63
+ toast ( {
64
+ title : "Error" ,
65
+ variant : "destructive" ,
66
+ description : description_text ,
67
+ } ) ;
68
+ } else {
69
+ toast ( {
70
+ title : "Error" ,
71
+ variant : "destructive" ,
72
+ description : "An unexpected error occurred. Please try again." ,
73
+ } ) ;
59
74
}
60
- toast ( {
61
- title : "Error" ,
62
- variant : "destructive" ,
63
- description : description_text ,
64
- } ) ;
65
75
}
66
76
} ;
67
77
0 commit comments