Skip to content

Commit ce0c88a

Browse files
authored
docs: add docs for the new error option for subscribeAction method (#1746)
1 parent 08a6da8 commit ce0c88a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/api/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,20 @@ const store = new Vuex.Store({ ...options })
233233
})
234234
```
235235
236-
Most commonly used in plugins. [Details](../guide/plugins.md)
236+
> New in 3.4.0
237+
238+
Since 3.4.0, `subscribeAction` can also specify an `error` handler to catch an error thrown when an action is dispatched. The function will receive an `error` object as the third argument.
239+
240+
``` js
241+
store.subscribeAction({
242+
error: (action, state, error) => {
243+
console.log(`error action ${action.type}`)
244+
console.error(error)
245+
}
246+
})
247+
```
248+
249+
The `subscribeAction` method is most commonly used in plugins. [Details](../guide/plugins.md)
237250
238251
### registerModule
239252

0 commit comments

Comments
 (0)