GoogleCloudPlatform / GoogleCloudPlatform/stackdriver-errors-js

Fails to report an Angular `HttpErrorResponse`

Đang mở
#81 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
360
Fork
54
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## As is

* Using Angular
* Make a service request, throw a 500`HttpErrorResponse`
* Report this error with `StackdriverErrorHandler`
* Get a 400 from the service, error never reported

These errors do not have a stack trace, so the payload sent to the clouderrorreporting api was:

```json
{
"serviceContext": { "service": "my-service" },
"context": {
"httpRequest": {
"userAgent": "Mozilla/5.0 ...",
"url": "http://localhost:3000/app/123"
}
},
"message": "Error extracting stack trace: Error: Cannot parse given Error object\n[object Object]\n (::)"
}
```

The service then responded with:

> 400 - ReportedErrorEvent.context must contain a location unless `message` contain an exception or stacktrace.

## Expected

Errors without a stack would be serialized in a way to maintain as much information as possible.

It is surprising to send "Error extracting stack trace" instead of a message representing the error trying to be reported.

One quick fix I tried to implement was to `JSON.stringify` errors before reporting, those were rejected by the service as "too long".

Overall, would love if the client would do *everything possible* to ensure the error gets reported.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.