Skip to content

Commit

Permalink
Adding fix to throw error where API not initialised
Browse files Browse the repository at this point in the history
  • Loading branch information
em0ney committed May 5, 2015
1 parent 12a75d2 commit 3b0253e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/server/rollbar-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ var reportAPIConnectionNotPossible = function() {
console.log(message);
};

throwErrorIfNotInitialised = function() {
if (!allNecessaryKeysAvailable()) {
throw new Meteor.Error(403, "Cannot connect to Rollbar API as the following environment variables are not available: [ "
+ environmentVarsRequired.join(', ') + " ]");
}
};

//
throwError = function(message) {
check(message, String);
throwErrorIfNotInitialised();
var exceptionDetails = arguments.length > 1 ? arguments[1] : {};
var logLevel = arguments.length > 2 ? arguments[2] : 'error';
check(exceptionDetails, Object);
Expand All @@ -46,6 +54,7 @@ handleError = function(error) {
var logLevel = arguments.length > 2 ? arguments[2] : 'error';
check(payloadData, Object);
check(logLevel, String);
throwErrorIfNotInitialised();
rollbar.handleErrorWithPayloadData(error, {
level: logLevel,
custom: payloadData
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'saucecode:rollbar',
version: '0.0.2',
version: '0.0.3',
summary: 'Rollbar error reporting integrations for Meteor',
documentation: 'README.md'
});
Expand Down

0 comments on commit 3b0253e

Please sign in to comment.