Closed FelipeBodelon closed 3 months ago
Zeitwerk is likely configured to eager load app/controllers
before app/misc
. Since Rodauth loads feature files on-demand when enable
is called, Rodauth::InternalRequestError
will be undefined at the time controllers are being loaded, because enable :internal_request
was not yet called on a Rodauth auth class, and lib/rodauth/features/internal_request.rb
is the file that defines this error class.
You should be able to fix this by passing the constant name to rescue_from
instead of the constant itself, which will remove the requirement that the constant needs to be defined at the time of the rescue_from
call.
rescue_from "Rodauth::InternalRequestError" do |e|
# ...
end
Having some issues with using Rodauth's InternalRequestError when eager_load is set to true. My app crashes and can't start correctly.
The issue is present when attempting to rescue from rodauth internal request errors, using internal requests in a controller method.
I'm using Rails version
7.0.3
with ruby3.2.2
and rodauth-rails1.13
and rodauth0.3.3
The code just makes use of said error with a rescue_from block. Haven't really faced an issue like this before, where should I be looking at?
It seems to be an issue when eager_loading with zeitwerk