mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 17:56:30 -05:00
MediaController: Handle MediaBackendErrors
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
8e7be737fa
commit
3aeda955d9
1 changed files with 12 additions and 0 deletions
|
@ -9,6 +9,7 @@ import {
|
|||
Controller,
|
||||
Delete,
|
||||
Headers,
|
||||
InternalServerErrorException,
|
||||
NotFoundException,
|
||||
Param,
|
||||
Post,
|
||||
|
@ -21,6 +22,7 @@ import {
|
|||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import {
|
||||
ClientError,
|
||||
MediaBackendError,
|
||||
NotInDBError,
|
||||
PermissionError,
|
||||
} from '../../../errors/errors';
|
||||
|
@ -66,6 +68,11 @@ export class MediaController {
|
|||
if (e instanceof ClientError || e instanceof NotInDBError) {
|
||||
throw new BadRequestException(e.message);
|
||||
}
|
||||
if (e instanceof MediaBackendError) {
|
||||
throw new InternalServerErrorException(
|
||||
'There was an error in the media backend',
|
||||
);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +93,11 @@ export class MediaController {
|
|||
if (e instanceof NotInDBError) {
|
||||
throw new NotFoundException(e.message);
|
||||
}
|
||||
if (e instanceof MediaBackendError) {
|
||||
throw new InternalServerErrorException(
|
||||
'There was an error in the media backend',
|
||||
);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue