softech
softech

Reputation: 376

Sentry javascript integration with Raven.JS

My JS code to get it working is

<script src="/assets/js/jquery.min.js"></script>
<script src="https://cdn.ravenjs.com/3.26.4/raven.min.js" crossorigin="anonymous"></script>
<script type="text/javascript">
    $(window).load(function (argument) {
        Raven.config('https://[email protected]/xxxxxx').install();
    });
</script>

But it does not sending console error to sentry, though

<script src="/assets/js/jquery.min.js"></script>
<script src="https://cdn.ravenjs.com/3.26.4/raven.min.js" crossorigin="anonymous"></script>
<script type="text/javascript">
    $(window).load(function (argument) {
        Raven.config('https://[email protected]/xxxxxx').install();
        Raven.captureException("catch error");
    });
</script>

will send catch error to sentry also tried to catch error manually & send it to sentry that is also not working

<script type="text/javascript">
    $(window).load(function (argument) {
        Raven.config('https://[email protected]/1214721').install();
    });
    window.onerror = function(message, source, lineno, colno, error) {
        Raven.captureException(error);
        return false;
    }
</script>

What does I am missing?

Upvotes: 0

Views: 375

Answers (1)

softech
softech

Reputation: 376

removing $(window).load(function (argument) {}); has worked for me. Just place Raven.config('https://[email protected]/1214721').install(); directly after jquery.js file

Upvotes: 0

Related Questions