Modular actions #317
pythonicode
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @TheEdoRan I love your library.
Just wondering -- a common pattern that I see is that I'll create an action say unpauseCampaign, another action pauseCampaign and maybe I'll want an action that uses these previously created actions called toggleCampaign which pauses if it's currently active or resumes the campaign if it's currently paused.
Right now I don't know of a super good method for calling the other actions from the toggleCampaign action? I can call it directly and get the SafeActionResult -- however if pauseCampaign throws an error I want the toggleCampaign to throw as well but since safe actions don't throw then there's no good way to propogate the error when using the action.
My current workaround involves creating a unpauseCampaign function and a unpauseCampaignAction action as two separate entities in the same file. Not sure if this is good or bad practice? Is this intended to not expose the underlying action function to the programmer? It would be nice if I could do like unpauseCampaign.raw(args) or something like this which will just call the underlying action which does the schema validation but does not catch and return the server errors instead just throws like a regular function would.
Beta Was this translation helpful? Give feedback.
All reactions