UNPKG

nralcm

Version:

This is a framework based on NodeJs to manage rest api request lifecycle

21 lines (20 loc) 721 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const enums_1 = require("../../common/enums"); /** * Default ExceptionHandler to handle all expceptions in rest api */ class ExceptionHandler { /** * Method for handle exception * @param context HttpContext Object * @param exception Exception Object */ handleException(context, exception) { // log your exception // console.log("Stack", exception.stack); context.response.type("application/json").status(enums_1.StatusCode.InternalServerError).send({ message: "Oops! Something went wrong. Please try after sometime." }); return; } } exports.ExceptionHandler = ExceptionHandler;