简体   繁体   English

Sentry javascript 与 Raven.JS 的集成

[英]Sentry javascript integration with Raven.JS

My JS code to get it working is我让它工作的JS代码是

<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://xxxxxxxxxxxxxxxxxxxxxxxx@sentry.io/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://xxxxxxxxxxxxxxxxxxxxxxxx@sentry.io/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将向哨兵发送catch error也尝试手动捕获错误并将其发送给同样不起作用的哨兵

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

What does I am missing?我缺少什么?

removing $(window).load(function (argument) {});删除$(window).load(function (argument) {}); has worked for me.对我有用。 Just place Raven.config('https://d28cbc1dcf354e91aefb0bc3480dd7d4@sentry.io/1214721').install();只需放置Raven.config('https://d28cbc1dcf354e91aefb0bc3480dd7d4@sentry.io/1214721').install(); directly after jquery.js file直接在jquery.js文件之后

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM