Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Bugsnag V2 (#345)
Browse files Browse the repository at this point in the history
* Adding Bugsnag integration

* Testing bugsnag reporting

* Testing bugsnag in publish function

* Integrate with error handler

* Switched to the fork

* Revert first test

* Revert test code
  • Loading branch information
JoeStanton authored Jan 23, 2017
1 parent 63674c8 commit dec3c64
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ BADGER_BRAIN_HOST="BADGER-BRAIN-GRAPHQL-URL"
TWITTER_KEY="RB-TWITTER-KEY"
TWITTER_SECRET="RB-TWITTER-SECRET"
INSTAGRAM_ACCESS_TOKEN="RB-INSTAGRAM_ACCESS_TOKEN"
BUGSNAG_KEY="BUGSNAG-API-KEY"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"babel-preset-react": "^6.11.1",
"babel-register": "^6.14.0",
"bluebird": "^3.4.6",
"bugsnag": "https://github.com/redbadger/bugsnag-node#d877e32aab8b7d507ed3b66cd487e3d3b137dcd1",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"classnames": "^2.2.5",
Expand Down
17 changes: 14 additions & 3 deletions services/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import bugsnag from 'bugsnag';

import doPublish from './publish';
import doContactUs from './contact_us';
import doSignUp from './mailchimp/sign-up/index';
import doUpdateUser from './mailchimp/update-user/index';

bugsnag.register(process.env.BUGSNAG_KEY);
bugsnag.configure({
autoNotifyUncaught: true,
releaseStage: process.env.ENV,
});

const cbWithErrorHandling = cb => (e, body) => {
if (e) {
e.message = `[500] ${e.message}`.replace(/\n/g, ''); // eslint-disable-line no-param-reassign
return cb(e);
bugsnag.notify(e, () => {
e.message = `[500] ${e.message}`.replace(/\n/g, ''); // eslint-disable-line no-param-reassign
return cb(e);
});
} else {
return cb(null, body);
}
return cb(null, body);
};

const errorHandlerWrapper = f => (event, context, cb) => {
Expand Down
16 changes: 14 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,14 @@ [email protected], buffer@^4.9.0:
ieee754 "^1.1.4"
isarray "^1.0.0"

"bugsnag@https://github.com/redbadger/bugsnag-node#d877e32aab8b7d507ed3b66cd487e3d3b137dcd1":
version "1.9.0"
resolved "https://github.com/redbadger/bugsnag-node#d877e32aab8b7d507ed3b66cd487e3d3b137dcd1"
dependencies:
promise "7.x"
request "2.x"
stack-trace "0.0.9"

builtin-modules@^1.0.0, builtin-modules@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
Expand Down Expand Up @@ -5219,7 +5227,7 @@ promise.pipe@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/promise.pipe/-/promise.pipe-3.0.0.tgz#b8f729867f54353996e6d8e86f3bbd56882e32a6"

promise@^7.1.1:
promise@7.x, promise@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
dependencies:
Expand Down Expand Up @@ -5635,7 +5643,7 @@ replaceall@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/replaceall/-/replaceall-0.1.6.tgz#81d81ac7aeb72d7f5c4942adf2697a3220688d8e"

request@^2.55.0, request@^2.69.0, request@^2.72.0, request@^2.79.0:
request@2.x, request@^2.55.0, request@^2.69.0, request@^2.72.0, request@^2.79.0:
version "2.79.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
dependencies:
Expand Down Expand Up @@ -6007,6 +6015,10 @@ sshpk@^1.7.0:
jsbn "~0.1.0"
tweetnacl "~0.14.0"

[email protected]:
version "0.0.9"
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.9.tgz#a8f6eaeca90674c333e7c43953f275b451510695"

stat-mode@^0.2.0:
version "0.2.2"
resolved "https://registry.yarnpkg.com/stat-mode/-/stat-mode-0.2.2.tgz#e6c80b623123d7d80cf132ce538f346289072502"
Expand Down

0 comments on commit dec3c64

Please sign in to comment.