Skip to content

Teach #from_hash to raise TypeError when argument is not a Hash#203

Open
myabc wants to merge 3 commits intotrailblazer:masterfrom
myabc:from_hash-fixes
Open

Teach #from_hash to raise TypeError when argument is not a Hash#203
myabc wants to merge 3 commits intotrailblazer:masterfrom
myabc:from_hash-fixes

Conversation

@myabc
Copy link

@myabc myabc commented Nov 16, 2016

@apotonick An alternative would be for #from_hash to fail silently (i.e. data = {} unless ::Hash === data). However, I think raising a TypeError makes more sense in a web application context. it allows the Operation or web framework Controller to rescue TypeError and return a 400 to the client.

Loading
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 this pull request may close these issues.

1 participant