rmcafee / discord_ex

Discord Elixir Library
MIT License
48 stars 13 forks source link

Misleading error with incorrect token #34

Closed jussih closed 7 years ago

jussih commented 7 years ago

When trying to start discord_ex with incorrect API token, we get the following stack trace:

    ** (FunctionClauseError) no function clause matching in Integer.parse/2
        (elixir) lib/integer.ex:238: Integer.parse(nil, 10)
        (discord_ex) lib/discord_ex/client/client.ex:54: DiscordEx.Client.start_link/1
        (ircord) lib/bridge.ex:27: Ircord.Bridge.init/1
        (stdlib) gen_server.erl:365: :gen_server.init_it/2
        (stdlib) gen_server.erl:333: :gen_server.init_it/6
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

Getting to the real error requires digging through the discord_ex sources. A better error message for this common case would save time spent on debugging.

jussih commented 7 years ago

This seems to be taken care of in master already (https://github.com/rmcafee/discord_ex/commit/a38b582d8e63da3b4ebc43374f97f543f9e5d596). I was using the latest version from Hex which does not have this yet. Closing issue.