Cobenian / raygun

A raygun client for Elixir
Apache License 2.0
19 stars 15 forks source link

Error when using Raygun.Plug without an user #28

Open PaoloLaurenti opened 7 years ago

PaoloLaurenti commented 7 years ago

If you plug Raygun without specifying any user, every time you try to log an error Raygun does not work and reports the following error:

** (exit) an exception was raised:
    ** (BadFunctionError) expected a function, got: nil
        (raygun) lib/raygun/plug.ex:39: Raygun.Plug.get_user/2
        (hermex) lib/raygun/plug.ex:61: Hermex.Router.call/2
        (hermex) lib/hermex/endpoint.ex:1: Hermex.Endpoint.phoenix_pipeline/1
        (hermex) lib/plug/debugger.ex:123: Hermex.Endpoint."call (overridable 3)"/2
        (hermex) lib/hermex/endpoint.ex:1: Hermex.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4

Here's the configuration I made in Phoenix for my router inside web.ex:

def router do
    quote do
      use Phoenix.Router
      use Raygun.Plug
    end
  end

If I configure an user like the example in the Readme, everything works fine.