Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.server.on500(function(context, err){
var req = context.req;
var res = context.res;
logger.error("===============================");
logger.error("Uncaught Exception");
logger.error(err);
logger.error(req.method, ' ', req.url);
logger.error(err.stack);
try {
res.status.internalServerError();
} catch(ex){
logger.error("error sending 500: ", ex);
}
});
this.server.on500(function(context, err){
var req = context.req;
var res = context.res;
logger.error("===============================");
logger.error("Uncaught Exception");
logger.error(err);
logger.error(req.method, ' ', req.url);
logger.error(err.stack);
try {
res.status.internalServerError();
} catch(ex){
logger.error("error sending 500: ", ex);
}
});
this.server.on500(function(context, err){
var req = context.req;
var res = context.res;
logger.error("===============================");
logger.error("Uncaught Exception");
logger.error(err);
logger.error(req.method, ' ', req.url);
logger.error(err.stack);
try {
res.status.internalServerError();
} catch(ex){
logger.error("error sending 500: ", ex);
}
});
this.server.on500(function(context, err){
var req = context.req;
var res = context.res;
logger.error("===============================");
logger.error("Uncaught Exception");
logger.error(err);
logger.error(req.method, ' ', req.url);
logger.error(err.stack);
try {
res.status.internalServerError();
} catch(ex){
logger.error("error sending 500: ", ex);
}
});
function onStatusError (data){
var req = data.req;
var res = data.res;
var uri = req.url;
if (req.uri){
uri = req.uri.toString();
}
logger.error(req.method, uri, res.statusCode, data.message, data.detail);
}
this.server.on500(function(context, err){
var req = context.req;
var res = context.res;
logger.error("===============================");
logger.error("Uncaught Exception");
logger.error(err);
logger.error(req.method, ' ', req.url);
logger.error(err.stack);
try {
res.status.internalServerError();
} catch(ex){
logger.error("error sending 500: ", ex);
}
});
that.mediaTypes.connectMiddleware()(req, res, function(err){
if (!!err) {
if (err.match(/^Parse Error:/)){
res.status.badRequest(err);
return;
}
if (err === "Missing Content-Type"){
res.status.unsupportedMediaType("None provided.");
return;
}
if (err === "Unregistered content-type."){
res.status.unsupportedMediaType(req.headers['content-type']);
return;
}
logger.error("post mediaTypes middleware error:");
logger.error(err);
return cb(err);
} else {
cb(null, context(req, res));
}
});
} else {
this.server.on500(function(context, err){
var req = context.req;
var res = context.res;
logger.error("===============================");
logger.error("Uncaught Exception");
logger.error(err);
logger.error(req.method, ' ', req.url);
logger.error(err.stack);
try {
res.status.internalServerError();
} catch(ex){
logger.error("error sending 500: ", ex);
}
});