Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More idiomatic response tuples #28

Open
karlseguin opened this issue Dec 19, 2016 · 1 comment
Open

More idiomatic response tuples #28

karlseguin opened this issue Dec 19, 2016 · 1 comment
Assignees

Comments

@karlseguin
Copy link

It'd be nice if functions returned {:error, X} and {:ok, Y}. It results in more elegant client code that doesn't have to match against specific structures.

def(%Transmission.Response{id: id), do: ...

vs

def({:ok, %{id: id}}), do: ...

Same same with case and with

@karlseguin karlseguin changed the title More idiomatic API More idiomatic response tuples Dec 19, 2016
@ewandennis
Copy link
Contributor

Thanks for this @karlseguin and sorry for the long latency. This is obviously a breaking change for existing modules, although we do have the beginnings of this in the suppression list module @asgoel very kindly contributed. I suspected at design time that there might be API responses which didn't map cleanly to :ok or :error too and haven't yet bottomed out how to handle those. Will label this for the next major version bump nonetheless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants