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.

Disable for development

See original GitHub issue

I’m having trouble figuring out how to restore the window.onerror event after including Raven as an AMD dependancy.

I don’t want to use Raven at all during development, so I’m only calling config()/install() in production mode. But in dev mode all errors are still being thrown by TraceKit.report()… Which is pretty frustrating since the file/line number/stack trace isn’t helpful anymore in the browser dev tools.

I’ve tried calling uninstall() in dev mode but that didn’t help. Is there a reason you’re binding to window.onerror no matter what instead of doing it inside config() or install()?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:6
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

29reactions
paulredmondcommented, Aug 4, 2017

For those coming here trying to figure it out still, it was a config option I missed at first shouldSendCallback:

import Raven from 'raven-js';

const env = 'prod';
const release = '12345';

Raven
  .config('https://<example>@sentry.io/1234', {
    environment: env,
    release: release,
    shouldSendCallback: () => {
      // Do your logic here...
      return ['prod', 'staging'].indexOf(env) !== -1;
    },
  })
  .install();

If shouldSendCallback is false sentry will not report. No need for conditional reporting logic in your code with this 👍 .

4reactions
paragjnathcommented, Oct 30, 2017

I have used this way. It seems working for me

if (environment.production) { Raven.config('https://@sentry.io/') .install(); }

and in providers providers: [environment.production ? { provide: ErrorHandler, useClass: RavenErrorHandler } : [], ...

Please let me know if I am doing anything wrong here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable or disable Developer Mode in Windows 10 ...
How to disable Developer Mode in Windows 10? ; Step 1 - Just open the "Settings" app. ; Step 2 - Now, choose...
Read more >
Disable Code Like Magic With Feature Flags - CloudBees
Disable code in production without touching it. Sound like magic? It's not: gain that power by adopting feature flags.
Read more >
How Do You Disable Tomcat's Development Mode?
Disabling Tomcat's development mode is an important step before moving your Hybris Commerce application into production.
Read more >
Disable Drupal (>=8.0) caching during development
Disabling Drupal 8 and Drupal 9 caching (render cache, dynamic page cache, Twig cache) during development is useful for seeing changes without clearing...
Read more >
Visulaforce -disable development mode - Salesforce Developers
Visulaforce -disable development mode ... Name --> Setup --> My personal Information --> Personal Information . In the user detail , click Edit....
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