mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
refactor: remove try catches from controllers
This is handled by the ErrorExceptionMapping class Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
2cd4f412e5
commit
d142cbadeb
10 changed files with 133 additions and 424 deletions
|
@ -12,17 +12,12 @@ import {
|
|||
Post,
|
||||
Put,
|
||||
Req,
|
||||
UnauthorizedException,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { Session } from 'express-session';
|
||||
|
||||
import {
|
||||
AlreadyInDBError,
|
||||
InvalidCredentialsError,
|
||||
NoLocalIdentityError,
|
||||
} from '../../../errors/errors';
|
||||
import { AlreadyInDBError } from '../../../errors/errors';
|
||||
import { IdentityService } from '../../../identity/identity.service';
|
||||
import { LocalAuthGuard } from '../../../identity/local/local.strategy';
|
||||
import { LoginDto } from '../../../identity/local/login.dto';
|
||||
|
@ -62,6 +57,7 @@ export class AuthController {
|
|||
);
|
||||
return;
|
||||
} catch (e) {
|
||||
// This special handling can't be omitted since AlreadyInDBErrors get mapped to BadRequestException usually.
|
||||
if (e instanceof AlreadyInDBError) {
|
||||
throw new ConflictException(e.message);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue