Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docs for the new error option for subscribeAction method #1746

Merged
merged 2 commits into from
May 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,20 @@ const store = new Vuex.Store({ ...options })
})
```

Most commonly used in plugins. [Details](../guide/plugins.md)
> New in 3.4.0

Since 3.4.0, `subscribeAction` can also specify the `error` option to catch the error thrown during the action dispatch. The `error` option will take an additional `error` object as the 3rd argument.
kiaking marked this conversation as resolved.
Show resolved Hide resolved

``` js
store.subscribeAction({
after: (action, state, error) => {
console.log(`error action ${action.type}`)
console.error(error)
}
kiaking marked this conversation as resolved.
Show resolved Hide resolved
})
```

The `subscribeAction` method is most commonly used in plugins. [Details](../guide/plugins.md)

### registerModule

Expand Down