zhyu / nadia

Telegram Bot API Wrapper written in Elixir
MIT License
363 stars 79 forks source link

Error messages for incorrect arguments #147

Open HaleTom opened 3 years ago

HaleTom commented 3 years ago

I was doing:

    response = Nadia.get_updates(unseen_id)

And got:

[error] GenServer #PID<0.605.0> terminating
** (FunctionClauseError) no function clause matching in Nadia.API.build_request/2
    (nadia 0.7.0) lib/nadia/api.ex:47: Nadia.API.build_request(43, nil)
    (nadia 0.7.0) lib/nadia/api.ex:119: Nadia.API.request/3
    (app 0.1.1) lib/app/telegram/telegram.ex:87: App.Telegram.handle_info/2
    (stdlib 3.14.1) gen_server.erl:689: :gen_server.try_dispatch/4
    (stdlib 3.14.1) gen_server.erl:765: :gen_server.handle_msg/6
    (stdlib 3.14.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :check

Nothing mentioned that a map was expected.

I needed to do instead:

    response = Nadia.get_updates(offset: unseen_id)
etroynov commented 2 years ago

@HaleTom Hi can you create this PR here: https://github.com/etroynov/telegraph