mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-23 02:06:29 -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,
|
Controller,
|
||||||
Delete,
|
Delete,
|
||||||
Headers,
|
Headers,
|
||||||
|
InternalServerErrorException,
|
||||||
NotFoundException,
|
NotFoundException,
|
||||||
Param,
|
Param,
|
||||||
Post,
|
Post,
|
||||||
|
@ -21,6 +22,7 @@ import {
|
||||||
import { FileInterceptor } from '@nestjs/platform-express';
|
import { FileInterceptor } from '@nestjs/platform-express';
|
||||||
import {
|
import {
|
||||||
ClientError,
|
ClientError,
|
||||||
|
MediaBackendError,
|
||||||
NotInDBError,
|
NotInDBError,
|
||||||
PermissionError,
|
PermissionError,
|
||||||
} from '../../../errors/errors';
|
} from '../../../errors/errors';
|
||||||
|
@ -66,6 +68,11 @@ export class MediaController {
|
||||||
if (e instanceof ClientError || e instanceof NotInDBError) {
|
if (e instanceof ClientError || e instanceof NotInDBError) {
|
||||||
throw new BadRequestException(e.message);
|
throw new BadRequestException(e.message);
|
||||||
}
|
}
|
||||||
|
if (e instanceof MediaBackendError) {
|
||||||
|
throw new InternalServerErrorException(
|
||||||
|
'There was an error in the media backend',
|
||||||
|
);
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +93,11 @@ export class MediaController {
|
||||||
if (e instanceof NotInDBError) {
|
if (e instanceof NotInDBError) {
|
||||||
throw new NotFoundException(e.message);
|
throw new NotFoundException(e.message);
|
||||||
}
|
}
|
||||||
|
if (e instanceof MediaBackendError) {
|
||||||
|
throw new InternalServerErrorException(
|
||||||
|
'There was an error in the media backend',
|
||||||
|
);
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue