Closed mindonline closed 6 years ago
Please, consider pull request. #19 Also, may be some one helps, as intermediate solution I found this:
// Custom error handler
function ODataErrorHandler(err, _, res, next){
.....
}
/// YOUR DECORATORS HERE
export class NorthwindServer extends ODataServer{
....
static oldRequestHandlerRes;
static requestHandler(){
this.oldRequestHandlerRes = super.requestHandler();
return (req:express.Request, res:express.Response, next:express.NextFunction) => {
return next();
}
}
}
const app = express();
app.use(
NorthwindServer.create(),
NorthwindServer.oldRequestHandlerRes,
ODataErrorHandler
);
app.listen(3000);
Hi @mindonline, using odata-v4-server@0.2.11 you can define custom error request handler, see example here: https://github.com/jaystack/odata-v4-server/blob/master/src/example/advanced.ts#L84 and you can define the ODATA_V4_DISABLE_STACKTRACE environment variable to disable stacktrace using the default ODataErrorHandler.
How to disable this output due to security issues on raised errors like 404 ? I didn't saw any ways to overcome ODataErrorHandler behavior.