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

Return {:error, err} tuples instead of throwing errors #52

Closed
cpjolicoeur opened this issue Aug 4, 2016 · 5 comments · Fixed by #56
Closed

Return {:error, err} tuples instead of throwing errors #52

cpjolicoeur opened this issue Aug 4, 2016 · 5 comments · Fixed by #56

Comments

@cpjolicoeur
Copy link
Contributor

What was the original design decision to raise errors (e.g. in ExTwitter.Api.Base) instead of returning an error tuple? As ExTwitter users we are forced to try ... rescue code instead of just pattern matching against a more-standard {:ok, [...]} or {:error, reason} type return?

Just curious.

@parroty
Copy link
Owner

parroty commented Aug 5, 2016

Thanks for the feedback. In erlang/elixir term, it would be better to use the more-standard one you indicated. It was implemented in the very early phase for simplification of the interface.
I had considered about the change some time, but as it's breaking change, I haven't been able to come up with good way or timing for the change. If there's good way of the change, I appreciate suggestions or PRs.

@cpjolicoeur
Copy link
Contributor Author

It definitely is a breaking change, but assuming you are following semver, it's not really a problem as your library hasn't even reached the 1.0 milestone yet.

Making the changes and releasing it as 0.8 or something would be perfectly fine/normal in the semver world, and to me, this kind of change is definitely something that you'd want to have for any kind of 1.0 release.

I'll try to work through it a bit over the next few weeks and see if I can come up with a full PR for the switchover

@sotojuan
Copy link

sotojuan commented Sep 4, 2016

Any progress on this?

@cpjolicoeur
Copy link
Contributor Author

Still working on it. I'm actually down at ElixirConf currently, but haven't finished this up yet.

@sotojuan
Copy link

sotojuan commented Sep 4, 2016

No rush, just curious 👍

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

Successfully merging a pull request may close this issue.

3 participants