Skip to content

Commit

Permalink
fix [object object]
Browse files Browse the repository at this point in the history
  • Loading branch information
Tectual committed Oct 17, 2015
1 parent 6e824c5 commit 771b8de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
rollbar.init(this._settings.accessToken, this._settings.rollbar);
this._streams.squeeze.on('data', (function(_this) {
return function(data) {
var error, request, url;
var error, message, ref, ref1, request, url;
error = null;
_.each(data.log, function(log) {
if (_.includes(log.tags, 'error')) {
Expand All @@ -67,7 +67,12 @@
path: data.path
}
};
return rollbar.handleError(error.data, request);
message = (ref = error.data.data) != null ? ref : error.data;
if ((ref1 = message.output.statusCode) === 404) {
return rollbar.reportMessage(message.message, 'warning', request);
} else {
return rollbar.handleError(message, request);
}
}
};
})(this));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "good-hapi-rollbar",
"version": "0.1.1",
"version": "0.2.0",
"description": "Good Rollbar reporter for Hapi.js",
"main": "build/main",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion src/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class GoodRollbar
protocol: url[0]
route:
path: data.path
rollbar.handleError(error.data, request)
message = error.data.data ? error.data
if message.output.statusCode in [404]
rollbar.reportMessage message.message, 'warning', request
else
rollbar.handleError message, request

stream.pipe(@_streams.squeeze)

Expand Down

0 comments on commit 771b8de

Please sign in to comment.