-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Non-Error exception captured with keys: error, headers, message, name, ok #2292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This means that the object you provide is not an instance of You should (as the message points to) use |
@kamilogorek oh ok) tnx |
@kamilogorek still getting this error, even with this const exception = error.error || error.message || error.originalError || error;
const eventId = Sentry.captureException(exception); |
+1, still getting this error no matter how I put it.
export class SentryErrorHandler extends GeneralErrorHandler {
...
handleError(error) {
...
const exception = error.originalError || error.error || error
Sentry.captureException(exception)
}
}
|
I decided to do this Sentry.init({
dsn: environment.sentryUrl,
beforeSend(event, hint) {
/* tslint:disable:no-string-literal only-arrow-functions */
const isNonErrorException =
event.exception.values[0].value.startsWith('Non-Error exception captured') ||
hint.originalException['message'].startsWith('Non-Error exception captured');
/* tslint:enable:no-string-literal only-arrow-functions */
if (isNonErrorException) {
// We want to ignore those kind of errors
return null;
}
return event;
}
}); |
Thank you for the workaround @gchronos! I hope there will be a potential fix anytime soon. |
Just chiming in to say I am also getting these errors. I'm using Angular 8 and after reading quite a few issues on this, I realise that it might be a case of me not handling the error properly in my error handling component. I've tried the workarounds suggested by others defining the exception before being passed to captureException but this hasn't reduced the errors. It'd be great if anyone could give some further input on this or I'll just have to use GChronos's (Thanks!) solution. |
+1 |
1 similar comment
+1 |
Can someone provide repro that I could use to debug this? I tried to use base angular-cli app and I cannot reproduce this behavior. Thanks! |
@kamilogorek I believe you can init a new Angular 8 project, and make a http request towards a endpoint returning 500 and not catch the error in the http service so it propagates to Sentry. |
I can chime in with some more info, this is our ErrorHandler: @Injectable()
export class SentryErrorHandler implements ErrorHandler {
constructor() { }
handleError(error) {
Sentry.captureException(error.originalError || error.error || error);
}
} In our Sentry tracking we always get duplicate events for these ones:
(Other events are reported okay as one item in the list) We have collected a couple hundreds of these "Non.Error"-events, and interestingly they all have the following in common:
And the errors are mostly the following: {
error: [Object],
headers: [Object],
message: Http failure during parsing for https://foo.bar/baz,
name: HttpErrorResponse,
ok: False,
status: 200,
statusText: OK,
url: https://foo.bar/baz
} |
Ok I rendered the SentryErrorHandler injectable and implements ErrorHandler instead of extends and there are no more problems like that for me.
to
I had the first config for 2 years without problems but since the upgrade to Angular 8 I have several sentry exceptions. |
@jonathan-payiq have you been able to find out what causes this? Or do you just ignore all those Non-Error exceptions now? |
We are currently ignoring them. |
@jonathan-payiq how exactly are you ignoring them? Thanks in advance. |
We are currently using the following to ignore it. Sentry.init({
ignoreErrors: [
'Non-Error exception captured'
]
}); |
@kamilogorek were you able to reproduce the issue? |
Closing the issue, as it seems like the original issue has been partially resolved or there is a working solution. I'd prefer someone to create a new issue with a fresh description if it's still an issue. |
It has not been resolved. I just tried to integrate Sentry with Angular 8 and found this issue. |
I don't get it how can Sentry claim out of the box setup, it's completely false. |
I'm having this issue on an Express app I just inherited. No idea how this could happen, but it seems to be happening for most errors the app throws, and I'm using the standard Express setup from the docs. e.g. https://sentry.io/share/issue/bfd4f674c10b4b4a8b6a291dde8e2a66/ |
I hit this same error, although it was for the express request handler and not angular. Basically I was calling In the end, created a utility function that would turn whatever was provided into something more reasonable: export const handleMaybeError = err => {
if (err instanceof Error) return err
const newErr = new Error(err.message || 'unexpected')
for (const [key, value] of Object.entries(err)) {
newErr[key] = value
}
return newErr
}
export const someController = (req, res, next) => {
try {
await handleResponse(req, res)
} catch (err) {
next(handleMaybeError(err))
}
} This muxes up the stack traces I think, but really if it was a pojo passed into this, there was no stack trace anyway. In our instance, before this was fixed, the vast majority of events reported were for this particular issue and because it's a long-running node web server, breadcrumbs are near useless -- and all the errors get lumped into this one event type. |
this will evaluate to true/false |
Unlikely, while possible. It all comes down to what "error" you send down the stream. But after-all, this should include some kind of useful information. |
Why isn't this option documented anywhere? |
Thanks for your workaround, but I think we should add some null guards when getting value, otherwise it can cause the error: |
|
Hi @kamilogorek , what happend to the detailed documentation? Has it been removed since then? The only thing I could find is this: https://docs.sentry.io/platforms/javascript/guides/angular/troubleshooting/#events-with-non-error-exception |
I think this is where it lives now: https://docs.sentry.io/platforms/javascript/guides/angular/configuration/filtering/#decluttering-sentry |
OK, thanks. Too bad it's missing lots of the helpful details you wrote though. |
|
One thing to note: if you will ignore non exception like errors you may miss something which needs to be fixed just because of the wrong error type. In my case we are using it with Angular 14 like this
and it seem to handle every error from every API
|
@kamilogorek i am having troubles here. Sentry shows I don't understand if this is a issue on my side or if this is a wontfix from sentry. |
In @sentry/angular but the issue #2744 is about multiple errors not about having the Non-Error exception with HttpErrorResponse, should I still mention it there. |
Ah, you're using sentry-javascript/packages/angular/src/errorhandler.ts Lines 34 to 52 in a88a8bf
|
@kamilogorek thx you are the best. Wrote my own error extractor. That solves the problem |
We still get these errors with Angular 16 and @sentry/integrations 7.64.0, Can someone provide any update? Besides the workarounds, I would appreciate a fix from the package itself. |
Can you update to the latest version (there may have been improvements/fixes around this in the meanwhile - latest is 7.73.0 as of now)? If that does not fix this, can you provide more detail on what you are capturing - if you are using Sentry SaaS, links to events would be helpful too. |
@mydea we filter these errors out with a regex. This workaround works out for us |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)@angular/core
Version:
Description
I have initial setup for Angular app with global ErrorInterceptor
here how I send it
and I get this (Non-Error exception captured with keys: error, headers, message, name, ok) error again and again, and can't understand what is wrong from the description and how to reproduce it.
The text was updated successfully, but these errors were encountered: