UNPKG

hellohello234

Version:

Simple calculator API hosted on APIMATIC

36 lines (29 loc) 879 B
/** * hellohello234 * * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) */ 'use strict'; class BaseController { /** * Global error handling * @param {HttpContext} _context HttpContext containing request and response objects * @callback Callback function which returns error, response, context */ static validateResponse(_context) { const errorObj = { errorMessage: '', errorCode: '', errorResponse: _context.response.body, }; const returnObj = { error: errorObj, response: null, context: _context, }; returnObj.error.errorMessage = 'HTTP Response Not OK'; returnObj.error.errorCode = _context.response.statusCode; return returnObj; } } module.exports = BaseController;