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

Already on GitHub? Sign in to your account

Added eitherDecode and eitherDecode' #69

Merged
merged 1 commit into from Nov 20, 2012

Conversation

Projects
None yet
6 participants
Collaborator

basvandijk commented Feb 13, 2012

Hi Bryan,

When debugging REST API's that accept and return JSON it's really helpful to receive error messages why JSON decoding failed. The attached patch adds eitherDecode and eitherDecode' which are just like decode and decode' respectively but return an error message when decoding fails.

I'm not sure about the names yet but I couldn't think of something better.

Bas

@basvandijk basvandijk Added eitherDecode and eitherDecode'
They are just like decode and decode' respectively
but return an error message when decoding fails.
41daf5d
Collaborator

hvr commented Feb 14, 2012

+1

I usually define helper functions with that very type signature in almost every program of mine which uses aeson... :-)

+1! This is really important, and I'm currently doing some overly painful debugging to figure out why I'm getting Nothing back

Contributor

tibbe commented Jun 19, 2012

+1

I have needed this as well. Like Bas I'm not sure about the names.

+1 on the need! this exists in other libs like yaml (for example) as is really helpful to understand what is not formatting correctly. Getting a simple Nothing is :/

@bos bos added a commit that referenced this pull request Nov 20, 2012

@bos bos Merge pull request #69 from basvandijk/eitherDecode
Added eitherDecode and eitherDecode'
1fd60bc

@bos bos merged commit 1fd60bc into bos:master Nov 20, 2012

@tolysz tolysz pushed a commit to tolysz/aeson that referenced this pull request May 18, 2015

@bos bos Merge pull request #69 from basvandijk/eitherDecode
Added eitherDecode and eitherDecode'
43ea36d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment