membrane_core icon indicating copy to clipboard operation
membrane_core copied to clipboard

Disallow returning error tuple from callbacks

Open bblaszkow06 opened this issue 3 years ago • 0 comments

We found out that there's no generic enough way to handle {:error, reason} tuples returned from callbacks. Currently, errors that can be recovered from are now handled with use of configuration/lambdas passed via options. Fatal errors, on the other hand, are raised. That works pretty well and makes returning {:error, reason} pointless. Therefore, we shouldn't allow returning them anymore. In that case, returning :ok tuples doesn't make much sense though. So we could have

  • {actions, state} - when user wants to return actions
  • state - when user wants to return only state

That could be ambiguous if someone used a {list, term} for the state, so we'd have to either enforce the state to be a map or struct, or require returning {:ok, state} or {[], state}.

We should consider whether to deprecate or remove support for the old return values

bblaszkow06 avatar Feb 02 '22 15:02 bblaszkow06