question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatically log all thrown errors?

See original GitHub issue

Is there a way to get Raven to log all thrown errors? For some reason, it logs some throw calls but not others. I found that it tends to not log behavior that is nested further down the call stack.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:31 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
paulyoungcommented, Feb 15, 2013

Here you go:

var __hasProp = {}.hasOwnProperty,
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

window.Error = (function(_super) {

  __extends(_Class, _super);

  function _Class() {
    var error;
    error = _Class.__super__.constructor.apply(this, arguments);
    Raven.captureException(error);
    return error;
  }

  return _Class;

})(Error);
1reaction
mattrobenoltcommented, Feb 10, 2013

It all depends really on the callstack. When things start going into async land, it gets rough. For example, this would not do as expected:

Raven.context(function() {
  setTimeout(function() {
    throw new Error('crap');
  }, 1);
});

The internal function gets run in it’s own context outside of the main context. Node.js solves this with a thing called “domains”, but sadly, those don’t exist in browser land.

So if an error is uncaught and bubbles all the way to the top, it usually gets rejected because it’s 100% worthless at that point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Awesome Retrace Logging & Error Tracking Features
Retrace includes powerful error tracking and log management ... Find all the exceptions being thrown in your code; View Logs & Errors in ......
Read more >
c# - How to log all thrown exceptions? - Stack Overflow
Update: I'll clarify that a bit. I want standard .txt (or any custom) logs, the format doesn't matter. The main point is I...
Read more >
Either log or rethrow Java exceptions, but never do both
When an exception occurs in your Java code, you can log it or you can rethrow it -- but don't do both. Here's...
Read more >
Logging Exceptions in Java - Loggly
A look at common approaches to exception handling and logging in Java. The examples use Log4j2, but the concepts apply to many modern ......
Read more >
JavaScript Error Logging - LogRocket
LogRocket automatically captures all JavaScript errors from all users of a website or web app. The errors are automatically aggregated and you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found