vendredi 29 mars 2019

Ngrx Actions: Corresponding Error Actions for Each Action?

When implementing actions with Ngrx, does it make sense to have a corresponding error action for each action type?

For example:

Option A: Load_Object_Type_X, Load_Object_Type_B, Load_Object_Error

Option B: Load_Object_Type_X, Load_Object_Type_B, Load_Object_Type_A_Error, Load_Object_Type_B_Error

Options A and B can use the reducer to handle the error the exact same way (action reducer can handle both error types in Option B), but I feel that Option B might introduce an awkward quantity of actions with enough actions present. Option A represents that "some error" occurred and can include a stack trace, but the error action itself doesn't explicitly state what action was being processed when that error arose.

I've done some background reading and haven't found anything definitive on what the best practice is - wondering if there's any resources on this. Thanks!

Aucun commentaire:

Enregistrer un commentaire