Vuex-module-decorators: [Question] Should we throw the original error for action as well?

Created on 17 Sep 2018  路  5Comments  路  Source: championswimmer/vuex-module-decorators

I see that in here:
https://github.com/championswimmer/vuex-module-decorators/blob/615cfd81cd486217adfcbf41d27532a026e35a84/src/mutationaction.ts#L21-L32
And here as well:
https://github.com/championswimmer/vuex-module-decorators/blob/8b9e458b7dc35872c18e50ef91907cab5f2dd839/src/action.ts#L21-L51
For the former code, the exception caught by the async action is unbeknownstly swallowed, and for the latter code, the exception was rewritten, was this all intended?

Most helpful comment

All 5 comments

It isn't swallowed - it is pushed into console.error

My reasoning is that

  • for the former case, the problem is with the function of the user.
  • for the later case, the error is because the user did not use the library _the right way鈩笍_

So for the later I throw the exception, so the user is forced to correct it. For the former - it is not my business to prevent the user from performing the mutation that she herself has created. She gets the error log nevertheless

But I am open to changing this, if you have a different reasoning or different idea about how we can deal with this, I am all ears.

Thank you for taking time to use and/or evaluate this library

Yeah, I wished to control UI state during error in actions and I checked the error type by instanceof, so we should save the original error.

I have to say I really need this pr, I handle all kinds of error to render right UI.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MagnusJohansson picture MagnusJohansson  路  5Comments

souphuhn picture souphuhn  路  5Comments

tuvokki picture tuvokki  路  7Comments

Akumzy picture Akumzy  路  5Comments

Hamidrezana picture Hamidrezana  路  4Comments