File tree Expand file tree Collapse file tree 2 files changed +8
-21
lines changed
src/application/use-cases/auth Expand file tree Collapse file tree 2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,10 @@ export const signInUseCase =
30
30
throw new AuthenticationError ( 'User does not exist' ) ;
31
31
}
32
32
33
- let validPassword = false ;
34
- try {
35
- validPassword = await instrumentationService . startSpan (
36
- { name : 'verify password hash' , op : 'function' } ,
37
- ( ) => compare ( input . password , existingUser . password_hash )
38
- ) ;
39
- } catch ( err ) {
40
- console . error ( 'password hash comparison error' , err ) ;
41
- }
33
+ const validPassword = await instrumentationService . startSpan (
34
+ { name : 'verify password hash' , op : 'function' } ,
35
+ ( ) => compare ( input . password , existingUser . password_hash )
36
+ ) ;
42
37
43
38
if ( ! validPassword ) {
44
39
throw new AuthenticationError ( 'Incorrect username or password' ) ;
Original file line number Diff line number Diff line change @@ -35,18 +35,10 @@ export const signUpUseCase =
35
35
throw new AuthenticationError ( 'Username taken' ) ;
36
36
}
37
37
38
- let passwordHash = '' ;
39
- try {
40
- passwordHash = await instrumentationService . startSpan (
41
- { name : 'hash password' , op : 'function' } ,
42
- ( ) => hash ( input . password , PASSWORD_SALT_ROUNDS )
43
- ) ;
44
- } catch ( err ) {
45
- console . error ( 'password hash error' , err ) ;
46
- throw new AuthenticationError ( 'Failed to hash password' , {
47
- cause : err ,
48
- } ) ;
49
- }
38
+ const passwordHash = await instrumentationService . startSpan (
39
+ { name : 'hash password' , op : 'function' } ,
40
+ ( ) => hash ( input . password , PASSWORD_SALT_ROUNDS )
41
+ ) ;
50
42
51
43
const userId = authenticationService . generateUserId ( ) ;
52
44
You can’t perform that action at this time.
0 commit comments