mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
feat: add ErrorExceptionMapping as a global filter
This filters all error that the controller will throw and either maps them to the correct HttpException if they are internal errors like NotInDBError, or just leaves them be if they are not part in the map. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
2c7e82680e
commit
2cd4f412e5
1 changed files with 2 additions and 0 deletions
|
@ -12,6 +12,7 @@ import { AppModule } from './app.module';
|
||||||
import { AppConfig } from './config/app.config';
|
import { AppConfig } from './config/app.config';
|
||||||
import { AuthConfig } from './config/auth.config';
|
import { AuthConfig } from './config/auth.config';
|
||||||
import { MediaConfig } from './config/media.config';
|
import { MediaConfig } from './config/media.config';
|
||||||
|
import { ErrorExceptionMapping } from './errors/error-mapping';
|
||||||
import { ConsoleLoggerService } from './logger/console-logger.service';
|
import { ConsoleLoggerService } from './logger/console-logger.service';
|
||||||
import { BackendType } from './media/backends/backend-type.enum';
|
import { BackendType } from './media/backends/backend-type.enum';
|
||||||
import { setupSpecialGroups } from './utils/createSpecialGroups';
|
import { setupSpecialGroups } from './utils/createSpecialGroups';
|
||||||
|
@ -78,6 +79,7 @@ async function bootstrap(): Promise<void> {
|
||||||
app.useStaticAssets('public', {
|
app.useStaticAssets('public', {
|
||||||
prefix: '/public/',
|
prefix: '/public/',
|
||||||
});
|
});
|
||||||
|
app.useGlobalFilters(new ErrorExceptionMapping());
|
||||||
await app.listen(appConfig.port);
|
await app.listen(appConfig.port);
|
||||||
logger.log(`Listening on port ${appConfig.port}`, 'AppBootstrap');
|
logger.log(`Listening on port ${appConfig.port}`, 'AppBootstrap');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue