JulianMar / nuxt-bugsnag

Bugsnag module for nuxt.js
MIT License
49 stars 18 forks source link

onError callback not working #66

Closed FreekVR closed 9 months ago

FreekVR commented 11 months ago

I'm trying to exclude errors on a page with lots of external JS from being reported.

I thought I could do this via config.onError but it appears this callback is never executed?

        config: {
            apiKey: process.env.BUGSNAG_API_KEY,
            enabledReleaseStages: ['staging', 'production'],
            releaseStage: process.env.APP_ENV || 'development',
            appVersion: process.env.NUXT_ENV_VERCEL_GIT_COMMIT_SHA || 'unknown',
            onError: function() { return false; }
        }

My current workaround is to have a plugin;

import Bugsnag from '@bugsnag/js';

export default defineNuxtPlugin(() => {
    Bugsnag.addOnError(function() {
        return false;
    });
});
JulianMar commented 9 months ago

There is currently no way to implement this. Nuxt doesn't support adding functions to the runtime config.