Sentry JavaScript 与 Raven.JS 的集成



我的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>

但它不会向哨兵发送控制台错误

<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>

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>

我错过了什么?

删除$(window).load(function (argument) {});对我有用。只需将Raven.config('https://d28cbc1dcf354e91aefb0bc3480dd7d4@sentry.io/1214721').install();直接放在文件之后jquery.js

相关内容

  • 没有找到相关文章

最新更新