Sha256: 150bce9f03ba9bd21252d0607932c7eb1693fa79c899817d52b4a5c0cd27fe7a
Contents?: true
Size: 534 Bytes
Versions: 2
Compression:
Stored size: 534 Bytes
Contents
module Rails module Auth module ErrorPage # Render an error page in the event Rails::Auth::NotAuthorizedError is raised class Middleware def initialize(app, page_body: nil) fail TypeError, "page_body must be a String" unless page_body.is_a?(String) @app = app @page_body = page_body.freeze end def call(env) @app.call(env) rescue Rails::Auth::NotAuthorizedError [403, {}, [@page_body]] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails-auth-0.2.0 | lib/rails/auth/error_page/middleware.rb |
rails-auth-0.1.0 | lib/rails/auth/error_page/middleware.rb |