• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Freegle / iznik-nuxt3 / 9d3b6548-86d1-4c81-827d-530d35ea5990

23 Sep 2025 11:46AM UTC coverage: 46.008% (+0.2%) from 45.764%
9d3b6548-86d1-4c81-827d-530d35ea5990

push

circleci

edwh
MT: Recent post date not showing in substitutions.

1785 of 4628 branches covered (38.57%)

Branch coverage included in aggregate %.

4058 of 8072 relevant lines covered (50.27%)

114.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

32.08
/plugins/something-went-wrong.client.js
1
import * as Sentry from '@sentry/browser'
2
import { APIError, MaintenanceError } from '@/api/BaseAPI'
3
import { useMiscStore } from '~/stores/misc'
4
import { useRouter } from '#imports'
5
import { suppressException } from '~/composables/useSuppressException'
6

7
export default defineNuxtPlugin((nuxtApp) => {
38✔
8
  const originalErrorHandler = nuxtApp.vueApp.config.errorHandler
62✔
9

10
  nuxtApp.vueApp.config.errorHandler = (err, vm, info, ...rest) => {
62✔
11
    console.log('Vue errorHandler', err.message)
5✔
12
    if (err instanceof MaintenanceError) {
5!
13
      // This is thrown in response to API return codes from the server.
14
      throw err
×
15
    } else if (err instanceof APIError && vm && vm.$bvToast) {
5!
16
      const { request, response } = err
×
17
      try {
×
18
        // We have seen Sentry issues which look as though our console.error log here is itself causing an exception,
19
        // on older devices which might be less good at using console on complex objects.
20
        //
21
        // So log more carefully.
22
        console.log('Vue errorHandler')
×
23
        console.log('Err', err)
×
24
        console.log('Request', request)
×
25
        console.error('Response', response)
×
26
      } catch (e) {
27
        console.error('Error in toast logging', e)
×
28
      }
29

30
      // Trigger popup.
31
      const miscStore = useMiscStore()
×
32
      miscStore.setErrorDetails(err)
×
33

34
      Sentry.captureMessage('API error')
×
35

36
      return true
×
37
    } else if (suppressException(err)) {
5!
38
      return true
×
39
    }
40

41
    if (originalErrorHandler) {
5!
42
      return originalErrorHandler(err, vm, info, ...rest)
5✔
43
    }
44
  }
45

46
  window.addEventListener('unhandledrejection', function (event) {
62✔
47
    const reason = event?.reason?.message
×
48

49
    if (reason?.includes('Maintenance error')) {
×
50
      // The API may throw this, and it may not get caught.
51
      const router = useRouter()
×
52
      router.push('/maintenance')
×
53
    } else if (reason) {
×
54
      // No point alerting the user if we have no info.
55
      const miscStore = useMiscStore()
×
56
      const error = new Error(reason)
×
57
      miscStore.setErrorDetails(error)
×
58
      Sentry.captureMessage('Unhandled promise', reason)
×
59
    }
60
  })
61
})
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc