GoogleCloudPlatform / GoogleCloudPlatform/stackdriver-errors-js

Problem doing manual error reporting

Aperta
#64 4 commenti 4 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
360
Fork
54
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.