DefinitelyTyped/types/honeybadger/honeybadger-tests.ts
Christian Schuetz f7f7463517 fix: Honeybadger developmentEnvironments (#39441)
* fix: developmentEnvironments

- Updates config value from developmentEnvironment to
developmentEnvironments
- Updates files to align with prettier config
- Bumps package

* fix: Don't update package version
2019-11-04 11:25:15 -08:00

40 lines
889 B
TypeScript

import Honeybadger = require('honeybadger');
Honeybadger.configure({
apiKey: 'abcdef',
developmentEnvironments: ['development'],
});
const err = Error('error');
Honeybadger.notify(err, function notifyCallback(err: Error, notice: any) {
if (err) console.error(err);
console.log(notice);
});
Honeybadger.setContext({
user_id: 123,
});
Honeybadger.resetContext();
Honeybadger.resetContext({
user_id: 123,
});
const other_hb = Honeybadger.factory({ apiKey: 'zxcvbnm' });
other_hb.notify('This will go to an alternate project.');
Honeybadger.onUncaughtException(err => {
console.log(err);
});
function handler(event: any, context: any) {
console.log('Event:', event);
console.log('Context:', context);
throw new Error('Something went wrong.');
console.log("Shouldn't make it here.");
}
exports.handler = Honeybadger.lambdaHandler(handler);