mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
fix for #186: unhandled error when amd webhook returns non-success status code
This commit is contained in:
@@ -146,7 +146,11 @@ class TaskConfig extends Task {
|
|||||||
_onAmdEvent(cs, evt) {
|
_onAmdEvent(cs, evt) {
|
||||||
this.logger.info({evt}, 'Config:_onAmdEvent');
|
this.logger.info({evt}, 'Config:_onAmdEvent');
|
||||||
const {actionHook} = this.data.amd;
|
const {actionHook} = this.data.amd;
|
||||||
this.performHook(cs, actionHook, evt);
|
this.performHook(cs, actionHook, evt)
|
||||||
|
.catch((err) => {
|
||||||
|
this.logger.error({err}, 'Config:_onAmdEvent - error calling actionHook');
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -689,7 +689,10 @@ class TaskDial extends Task {
|
|||||||
_onAmdEvent(cs, evt) {
|
_onAmdEvent(cs, evt) {
|
||||||
this.logger.info({evt}, 'Dial:_onAmdEvent');
|
this.logger.info({evt}, 'Dial:_onAmdEvent');
|
||||||
const {actionHook} = this.data.amd;
|
const {actionHook} = this.data.amd;
|
||||||
this.performHook(cs, actionHook, evt);
|
this.performHook(cs, actionHook, evt)
|
||||||
|
.catch((err) => {
|
||||||
|
this.logger.error({err}, 'Dial:_onAmdEvent - error calling actionHook');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const handleErrors = (logger, app, resolve, reject, e) => {
|
|||||||
server.on('error', handleErrors.bind(null, logger, app, resolve, reject));
|
server.on('error', handleErrors.bind(null, logger, app, resolve, reject));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
logger.info({err: e, port: PORT}, 'httpListener error');
|
||||||
reject(e);
|
reject(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ const createHttpListener = (logger, srf) => {
|
|||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use('/', httpRoutes);
|
app.use('/', httpRoutes);
|
||||||
app.use((err, req, res, next) => {
|
app.use((err, _req, res, _next) => {
|
||||||
logger.error(err, 'burped error');
|
logger.error(err, 'burped error');
|
||||||
res.status(err.status || 500).json({msg: err.message});
|
res.status(err.status || 500).json({msg: err.message});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user