Skip to content

Can NOT capture error wrapped rxjs.Observable.error() #2533

@sizer

Description

@sizer

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.15.4

Description

My application(Angular@9) throws rxjs.Observable.error() and catch that by Sentry.captureException();.
At Sentry.io, I saw

Hub.push../node_modules/@sentry/hub/esm/hub.js.Hub.withScope
error
Non-Error exception captured with keys: ...

https://sentry.io/organizations/{myorg}/issues/1582573825/

It may be better that Sentry.captureException() could be to catch rxjs.Observable.error() simply.
Or had I mistaken for using @sentry/browser ??

code

import { Component } from "@angular/core";
import { Observable } from "rxjs";

@Component({
  selector: "app-root",
  template: `<button (click)="myProcess()"></button>`
})
export class AppComponent {
  public myProcess(): void {
    new Observable<{message: string}>(observer => {
      observer.error({message: "my failure..."});
    }).subscribe(result => console.log(result));
  }
}

@Injectable()
export class SentryErrorHandler implements ErrorHandler {
  constructor() {}
  handleError(error) {
    Sentry.captureException(error.originalError || error);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions