mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add audit logging to admin api
This commit is contained in:
parent
19eb8e9a6d
commit
98e391b867
@ -21,6 +21,8 @@ var i18n = require("@node-red/util").i18n; // TODO: separate module
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
errorHandler: function(err,req,res,next) {
|
errorHandler: function(err,req,res,next) {
|
||||||
|
//TODO: why this when rejectHandler also?!
|
||||||
|
|
||||||
if (err.message === "request entity too large") {
|
if (err.message === "request entity too large") {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
} else {
|
} else {
|
||||||
@ -39,6 +41,8 @@ module.exports = {
|
|||||||
return lang;
|
return lang;
|
||||||
},
|
},
|
||||||
rejectHandler: function(req,res,err) {
|
rejectHandler: function(req,res,err) {
|
||||||
|
//TODO: why this when errorHandler also?!
|
||||||
|
log.audit({event: "api.error",error:err.code||"unexpected_error",message:err.message||err.toString()},req);
|
||||||
res.status(err.status||500).json({
|
res.status(err.status||500).json({
|
||||||
code: err.code||"unexpected_error",
|
code: err.code||"unexpected_error",
|
||||||
message: err.message||err.toString()
|
message: err.message||err.toString()
|
||||||
|
Loading…
Reference in New Issue
Block a user