GoogleCloudPlatform / GoogleCloudPlatform/stackdriver-errors-js

Problem doing manual error reporting

オープン
#64 コメント 4 件 リアクション 4 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
360
フォーク
54
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi, I have code that does:

```
// In a promise `then` handler:
myRegister(new Error('some error'));
// ...
// Elsewhere in the code:
errorHandler.report(theNewError);
```

but the stackdriver API response is:

```
{
"error": {
"code": 400,
"message": "ReportedErrorEvent.context must contain a location unless `message` contain an exception or stacktrace.",
"status": "INVALID_ARGUMENT"
}
}
```

The request that is sent to stackdriver is:

```
{
"serviceContext": {"service": "webApp", "version": "whatever"},
"context": {
"user": "Joe User",
"httpRequest": {
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
"url": "http://localhost:3000/"
}
},
"message": "Error: {\"type\":\"An error during API handling\"}\n at then(function (/Users/murphyke/Documents/code/myapp/web/src/actions.js:224:0)"
};
```

What is the recommendation? Do I have to annotate the error object somehow?

Unhandled exceptions are reported correctly.

Using Chrome, btw.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。