Class: LcpRuby::Authorization::MisconfiguredPageError

Inherits:
Pundit::NotAuthorizedError
  • Object
show all
Defined in:
lib/lcp_ruby/authorization/misconfigured_page_error.rb

Overview

Runtime page-gate error: a page reached during request dispatch has no parseable ‘visible_when:` and no zone gate, OR has a malformed `visible_when:` shape that the boot validator missed.

Descends from Pundit::NotAuthorizedError (NOT AuthorizationError) so the host’s existing ‘rescue_from Pundit::NotAuthorizedError` renders the standard 403 / access-denied UX. See docs/design/authorization_hardening.md § “MisconfiguredPageError’s Pundit lineage is an intentional departure”.

Carries the runtime ‘code:` (AUTH-002-runtime vs AUTH-003) so the rescue handler in `PageAuthorization` can emit a precisely-tagged record_error. `page_name` aliases `message` (set by `super`) —no separate ivar.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page_name, code: Codes::AUTH_002_RUNTIME) ⇒ MisconfiguredPageError

Returns a new instance of MisconfiguredPageError.



22
23
24
25
# File 'lib/lcp_ruby/authorization/misconfigured_page_error.rb', line 22

def initialize(page_name, code: Codes::AUTH_002_RUNTIME)
  @code = code
  super(page_name)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



20
21
22
# File 'lib/lcp_ruby/authorization/misconfigured_page_error.rb', line 20

def code
  @code
end