diff --git a/index.js b/index.js index c2ae649..8e4742f 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,7 @@ function Platform (config) { } Platform.prototype.handleError = function (event, e) { if (event.name === 'event' || (event.name === 'route' && this.req.job)) { - return this.res.job_fail('Unhandled Exception', e.message || 'Unhandled Exception', e) + return this.res.job_fail('Failed', e.message || 'unhandled_error', e) } if (event.name === 'route') { return this.res.error(e) diff --git a/lib/response.js b/lib/response.js index 418dd03..105fb7d 100644 --- a/lib/response.js +++ b/lib/response.js @@ -72,7 +72,7 @@ Response = (function () { Response.prototype.job_fail = function (status, msg, data) { this.meta('set_job_status', 'failed') this.meta('set_job_status_message', status) - this.meta('set_job_failure_message', msg) + this.meta('set_job_failure_message', msg || 'unexpected_error') if (data) { this._respond(errorToObject(data)) } diff --git a/test/index.spec.js b/test/index.spec.js index cc8d9e2..d3b954b 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -227,7 +227,7 @@ describe('index', function () { expect(context.succeed).to.have.been.called() let args = context.succeed.args[0][0] expect(args.meta.set_job_status).to.equal('failed') - expect(args.meta.set_job_status_message).to.equal('Unhandled Exception') + expect(args.meta.set_job_status_message).to.equal('Failed') expect(args.meta.set_job_failure_message).to.equal('no') expect(args.body.message).to.equal('no') }) @@ -250,7 +250,7 @@ describe('index', function () { expect(context.succeed).to.have.been.called() let args = context.succeed.args[0][0] expect(args.meta.set_job_status).to.equal('failed') - expect(args.meta.set_job_status_message).to.equal('Unhandled Exception') + expect(args.meta.set_job_status_message).to.equal('Failed') expect(args.meta.set_job_failure_message).to.equal('no') expect(args.body.message).to.equal('no') done()