diff --git a/lib/server/rollbar-server.js b/lib/server/rollbar-server.js index 7317e33..21a0306 100644 --- a/lib/server/rollbar-server.js +++ b/lib/server/rollbar-server.js @@ -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); @@ -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 diff --git a/package.js b/package.js index 0c4546a..81aa79b 100644 --- a/package.js +++ b/package.js @@ -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' });