Skip to content

Typescript for error on fallback function? #12571

Answered by AbhiPrasad
louispotok asked this question in Q&A
Discussion options

You must be logged in to vote

@louispotok this is intentional because anything can be used with a throw statement. See: https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md#updated-error-types-to-be-unknown-instead-of-error

I think you should use typeof Error checks to enforce that the thrown variable is an error.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@louispotok
Comment options

@AbhiPrasad
Comment options

Answer selected by louispotok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants