diff options
Diffstat (limited to 'hooks/handleErrors.ts')
-rw-r--r-- | hooks/handleErrors.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/hooks/handleErrors.ts b/hooks/handleErrors.ts new file mode 100644 index 0000000..2a3c728 --- /dev/null +++ b/hooks/handleErrors.ts @@ -0,0 +1,11 @@ +import { HookContext } from '@feathersjs/feathers'; +import logger from '../logger'; + + +export default async (context: HookContext): Promise<HookContext> => { + context.result = context.error.message; + context.statusCode = context.error.code; + logger.error(context.error); + return context; +}; + |