@tsed/cli
Version:
CLI to bootstrap your Ts.ED project
21 lines (18 loc) • 655 B
JavaScript
import { defineTemplate } from "../utils/defineTemplate.js";
export default defineTemplate({
id: "exception-filter",
label: "Exception Filter",
description: "Create an exception filter class annotated with @Catch to handle thrown errors in src/filters.",
fileName: "{{symbolName}}.exception-filter",
outputDir: "{{srcDir}}/filters",
render(symbolName) {
return `import {BaseContext} from "@tsed/di";
import {Catch, ExceptionFilterMethods} from "@tsed/platform-exceptions";
@Catch(Error)
export class ${symbolName} implements ExceptionFilterMethods {
catch(exception: Exception, ctx: BaseContext) {
}
}
`;
}
});