import { ApiController , Controller , HttpGet } from '../../../../index' ; import { NExceptionFilter , NExceptionFilterAsync , ResultFilterOne , ResultFilterOneAsync } from '../middlewares/filter' ; @ Controller ( '/exception' , { exceptions : [ NExceptionFilter , NExceptionFilterAsync ] , result : [ ResultFilterOne , ResultFilterOneAsync , { useClass : ResultFilterOne , data : { role : 'result-filter-admin' } } , { useClass : ResultFilterOneAsync , data : { role : 'async-result-filter-admin' } } ] } ) export class ExceptionController extends ApiController { @ HttpGet ( '/result-filter' ) filters ( ) { return this . response . locals . data ; } @ HttpGet ( '/n-exception' ) get ( ) { throw new Error ( 'NExceptionFilter thrown' ) ; } @ HttpGet ( '/n-exception-async' ) getN ( ) { throw new Error ( 'NExceptionFilterAsync thrown' ) ; } @ HttpGet ( '/exception-one' ) getTestExceptionOne ( ) { throw new Error ( 'SyncTestExceptionOne is thrown' ) ; } @ HttpGet ( '/exception-global' ) globalException ( ) { throw new Error ( 'GlobalTestException is thrown' ) ; } }