Skip to content

Commit

Permalink
chore: Improve LoginException
Browse files Browse the repository at this point in the history
  • Loading branch information
mapeveri committed Apr 4, 2024
1 parent 652ece5 commit acab79d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class LoginUserCommandHandler implements ICommandHandler<LoginUse
private async guardIsValidLogin(command: LoginUserCommand) {
const isValid: boolean = await this.socialAuthenticator.login(command.token);
if (!isValid) {
throw new LoginException();
throw new LoginException(command.email);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/languages/domain/user/loginException.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UnauthorizedException from '@src/shared/domain/exceptions/unauthorizedException';

export default class LoginException extends UnauthorizedException {
constructor() {
super('Invalid login', 'invalid_login');
constructor(email: string) {
super(`Invalid login for email: ${email}`, 'invalid_login');
}
}

0 comments on commit acab79d

Please sign in to comment.