airbrake-mini-client
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "airbrake-mini-client", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A lightweight alternative to airbrake-js.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -30,2 +30,13 @@ # airbrake-mini-client | ||
### Notify additional parameters | ||
```js | ||
airbrakeMini.notify({ | ||
error: new Error('BOOM'), | ||
context: { severity: 'warning' } | ||
params: {}, // put here any field you want | ||
environment: {}, // put here any field you want | ||
session: {} // put here any field you want | ||
}) | ||
``` | ||
### Configuration | ||
@@ -32,0 +43,0 @@ AirbrakeMini constructor takes the following mandatory parameter: |
@@ -0,1 +1,2 @@ | ||
var objectAssign = require('object-assign') | ||
var Reporter = require('./reporter') | ||
@@ -27,3 +28,6 @@ var stacktrace = require('./stacktrace') | ||
} else { | ||
payload.errors = [err] | ||
payload.errors = [stacktrace(err.error)] | ||
objectAssign(payload.context, err.context || {}) | ||
objectAssign(payload.params, err.params || {}) | ||
objectAssign(payload.session, err.session || {}) | ||
} | ||
@@ -30,0 +34,0 @@ this.reporter.notify(payload) |
@@ -105,5 +105,5 @@ /* eslint-env browser */ | ||
req.send(enrichedPayload) | ||
req.send(JSON.stringify(enrichedPayload)) | ||
} | ||
module.exports = Reporter |
@@ -31,2 +31,10 @@ /* eslint-env browser, mocha */ | ||
}) | ||
it('notifies using an object', () => { | ||
airbrake.notify({ error: new Error('BOOM!'), context: { severity: 'warning' } }) | ||
assert.isTrue(reporter.notify.calledOnce) | ||
var payload = reporter.notify.args[0][0] | ||
assert.equal(payload.id, '') | ||
assert.deepEqual(payload.context, { severity: 'warning', windowError: false, history: [] }) | ||
}) | ||
}) |
@@ -47,4 +47,4 @@ /* eslint-env browser, mocha */ | ||
assert.equal(requests[0].method, 'POST') | ||
assert.equal(requests[0].requestBody.test, 1) | ||
assert.equal(JSON.parse(requests[0].requestBody).test, 1) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12314
313
84