Hi, in some situations I need to broadcast a message from genserver, need to say it’s error, what kind of error, and also return the element that caused the error. So I end up with something like this:
{:enrollment_processed, {:error, {:already_enrolled, enrollment}}}
I guess it’s kinda ugly and error prone. What’s the best practice to deal with this?
a) tuple with more than 2 elements
{:enrollment_processed, {:error, :already_enrolled, enrollment}}
b) merge error + type of error
{:enrollment_processed, {:already_enrolled, enrollment}}
c) other solutions?
Note I need to have enrollment in this message, because based on that I can broadcast it to the right channel and the liveview can report which enrollment wasn’t saved.


















