Sentry-javascript: How to send custom exception correctly?

Created on 9 Nov 2018  路  3Comments  路  Source: getsentry/sentry-javascript

I'm doing now

       try {
            throw new FormValidationException(node, input);
        } catch (err) {
            Sentry.captureException(err);
        }

But I feel it's wrong.
Is there any other ways to send custom exception?

Question

Most helpful comment

Or just Sentry.captureException(new FormValidationException(node, input)) if you don't need anything inside try block and just want to send custom error.

All 3 comments

Why should this be wrong? This is perfectly fine.

Or just Sentry.captureException(new FormValidationException(node, input)) if you don't need anything inside try block and just want to send custom error.

Main question was answered. Feel free to reopen if still need any help. Cheers!

Was this page helpful?
0 / 5 - 0 ratings