Exception: Ruact::CurrentUserNotConfiguredError

Inherits:
Error
  • Object
show all
Defined in:
lib/ruact/errors.rb

Overview

Story 8.3 — raised by a standalone server-action block (a module that ‘extend`s ServerAction) when its body invokes ServerFunctions::StandaloneContext#current_user but no Ruact::Configuration#current_user_resolver has been configured. The message names both worked examples (Devise + hand-rolled session) so the developer can wire the resolver without leaving the stack trace.

Constant Summary collapse

DEFAULT_MESSAGE =
"Ruact.current_user requires Ruact.config.current_user_resolver to be set. " \
"Example (Devise): Ruact.configure { |c| c.current_user_resolver = ->(env) { env['warden']&.user } }. " \
"Example (hand-rolled session): Ruact.configure { |c| c.current_user_resolver = " \
"->(env) { User.find_by(id: env['rack.session'][:user_id]) } }."

Instance Method Summary collapse

Constructor Details

#initialize(message = DEFAULT_MESSAGE) ⇒ CurrentUserNotConfiguredError

Returns a new instance of CurrentUserNotConfiguredError.



41
42
43
# File 'lib/ruact/errors.rb', line 41

def initialize(message = DEFAULT_MESSAGE)
  super
end