devinus / poison

An incredibly fast, pure Elixir JSON library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Poison.decode/2 raises an exception when interger is given

relip opened this issue · comments

In the Poison document Poison.decode/2 should return an exception on error, instead it raises an exception when parameter is invalid such as nil or an integer.

Trace:

    :erlang.iolist_to_binary(1)
    (poison) lib/poison/parser.ex:35: Poison.Parser.parse/2
    (poison) lib/poison.ex:69: Poison.decode/2

I assume adding ArgumentError into the rescue exception list would be the simplest way?

exception in [ParseError, DecodeError] ->