lostisland / sawyer

Secret User Agent of HTTP
MIT License
249 stars 75 forks source link

Raise exception if none of json libraries could be required. #55

Closed spacewander closed 5 years ago

spacewander commented 6 years ago

Instead of returning nil and let it break in another place, raise exception as soon as thing goes wrong.

technoweenie commented 5 years ago

Thanks, this seems helpful. May I make a suggestion about the code though? I think the message should mention the various gems that Sawyer works with too.

yajl || multi_json || json || begin
  raise RuntimeError, "Sawyer requires a JSON gem: yajl, multi_json, or json"
end
spacewander commented 5 years ago

@technoweenie LGTM.