4

クライアント側で発生する可能性のある HTTP / JS エラーを収集するために、Sentry アプリケーションをセットアップしました。ただし、約 400 の HTTP リクエストを作成しようとすると、Sentry はリクエストを適切にキャプチャできなかったようです。

それは Sentry のデフォルトの動作ですか、それとも私のコード (以下) に何か欠けているのですか?

<!DOCTYPE html>
<html>
    <head>
            <title>Hi there</title>
            <script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
            <script src="https://cdn.ravenjs.com/2.1.1/raven.min.js"></script>
            <script>Raven.config('http://xxx@xxx.xxxxx.com/4').install();</script>
    </head>
    <body>
        Hello the world :-)
        <script type="text/javascript">
            $.get("http://somehttp400url.com/");
        </script>
    </body>
</html>

ご意見ありがとうございます

4

3 に答える 3

3

ajaxErrorハンドラー ( https://api.jquery.com/ajaxError/ )を使用できます。

$( document ).ajaxError(function( event, request, settings ) {
  Raven.captureException(new Error(JSON.stringify(request)));
});
于 2016-03-01T12:23:39.220 に答える