|
|
@@ -1,18 +1,22 @@
|
|
|
-import {Catch, ExceptionFilterMethods, PlatformContext, ResourceNotFound} from "@tsed/common";
|
|
|
+import {
|
|
|
+ Catch, ExceptionFilterMethods, PlatformContext, PlatformResponse, ResourceNotFound,
|
|
|
+} from '@tsed/common';
|
|
|
|
|
|
@Catch(ResourceNotFound)
|
|
|
export class ResourceNotFoundFilter implements ExceptionFilterMethods {
|
|
|
- async catch(exception: ResourceNotFound, ctx: PlatformContext) {
|
|
|
- const {response} = ctx;
|
|
|
+
|
|
|
+ async catch(exception: ResourceNotFound, ctx: PlatformContext): Promise<PlatformResponse<any>> {
|
|
|
+ const { response } = ctx;
|
|
|
|
|
|
const obj = {
|
|
|
status: exception.status,
|
|
|
message: exception.message,
|
|
|
- url: exception.url
|
|
|
+ url: exception.url,
|
|
|
};
|
|
|
|
|
|
return response
|
|
|
.status(exception.status)
|
|
|
.body(obj);
|
|
|
}
|
|
|
+
|
|
|
}
|