Skip to content

Commit 3c4ecd8

Browse files
committed
app.config.throwUnhandledErrorInProduction
1 parent 71cec81 commit 3c4ecd8

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/api/application.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ Unmounts a mounted application instance, triggering the unmount lifecycle hooks
9090
}
9191
```
9292

93+
## app.onUnmount() <sup class="vt-badge" data-text="3.5+" /> {#app-onunmount}
94+
95+
Registers a callback to be called when the app is unmounted.
96+
97+
- **Type**
98+
99+
```ts
100+
interface App {
101+
onUnmount(callback: () => any): void
102+
}
103+
```
104+
93105
## app.component() {#app-component}
94106

95107
Registers a global component if passing both a name string and a component definition, or retrieves an already registered one if only the name is passed.
@@ -619,7 +631,7 @@ Configure a prefix for all IDs generated via [useId()](/api/general#useid) insid
619631
620632
- **Default:** `undefined`
621633
622-
- **Example:**
634+
- **Example**
623635
624636
```js
625637
app.config.idPrefix = 'my-app'
@@ -630,3 +642,21 @@ Configure a prefix for all IDs generated via [useId()](/api/general#useid) insid
630642
const id1 = useId() // 'my-app:0'
631643
const id2 = useId() // 'my-app:1'
632644
```
645+
646+
## app.config.throwUnhandledErrorInProduction <sup class="vt-badge" data-text="3.5+" /> {#app-config-throwunhandlederrorinproduction}
647+
648+
Force unhandled errors to be thrown in production mode.
649+
650+
- **Type:** `boolean`
651+
652+
- **Default:** `false`
653+
654+
- **Details**
655+
656+
By default, errors thrown inside a Vue application but not explicit handled have different behavior between development and production modes:
657+
658+
- In development, the error is thrown and can possibly crash the application. This is to make the error more prominent so that it can be noticed and fixed during development.
659+
660+
- In production, the error will only be logged to the console to minimize the impact to end users. However, this may prevent errors that only happen in production from being caught by error monitoring services.
661+
662+
By setting `app.config.throwUnhandledErrorInProduction` to `true`, unhandled errors will be thrown even in production mode.

0 commit comments

Comments
 (0)