Javascript client side: Call to Sentry.captureException is working but calling an undefined function isn't

JavaScript client side.
I added the sentry bundle to head and init right after the body tag.
If I use the console:

Sentry.captureException(new Error("This is my fake error message"));

It captures the error.
But if I just type an undefined function, for example “sdflkhskdfjhsdf();” it doesn’t capture the error…
Any ideas why?

1 Like

Same issue. Were you able to find a solution?

<script src="https://browser.sentry-cdn.com/5.20.1/bundle.min.js" integrity="sha384-O8HdAJg1h8RARFowXd2J/r5fIWuinSBtjhwQoPesfVILeXzGpJxvyY/77OaPPXUo" crossorigin="anonymous">
</script>
<script type="text/javascript">
    Sentry.init({
        dsn: '{{ env('SENTRY_LARAVEL_DSN') }}',
        environment: '{{ env('APP_ENV') }}',
        debug: true,
    });