File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
packages/bridge/src/runtime/composables Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -4,19 +4,24 @@ import { useNuxtApp } from '../nuxt'
4
4
5
5
export const NUXT_ERROR_SIGNATURE = '__nuxt_error'
6
6
7
+ /* @__NO_SIDE_EFFECTS__ */
7
8
export const useError = ( ) => toRef ( useNuxtApp ( ) . payload , 'error' )
8
9
9
- export interface NuxtError < DataT = unknown > extends H3Error < DataT > { }
10
+ export interface NuxtError < DataT = unknown > extends H3Error < DataT > { }
10
11
11
12
export const showError = < DataT = unknown > (
12
13
error : string | Error | Partial < NuxtError < DataT > >
13
14
) => {
14
15
const nuxtError = createError < DataT > ( error )
15
16
16
17
try {
17
- const nuxtApp = useNuxtApp ( )
18
- nuxtApp . callHook ( 'app:error' , nuxtError )
19
18
const error = useError ( )
19
+
20
+ if ( process . client ) {
21
+ const nuxtApp = useNuxtApp ( )
22
+ nuxtApp . callHook ( 'app:error' , nuxtError )
23
+ }
24
+
20
25
error . value = error . value || nuxtError
21
26
} catch {
22
27
throw nuxtError
You can’t perform that action at this time.
0 commit comments