Class: Hanami::Router::NotFoundError

Inherits:
Error
  • Object
show all
Defined in:
lib/hanami/extensions/router/errors.rb

Overview

Error raised when a request is made for a missing route.

Raised only when using hanami-router as part of a full Hanami app. When using hanami-router standalone, the behavior for such requests is to return a “Not Found” response.

Since:

  • 2.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ NotFoundError

Returns a new instance of NotFoundError.

Since:

  • 2.1.0



21
22
23
24
25
26
# File 'lib/hanami/extensions/router/errors.rb', line 21

def initialize(env)
  @env = env

  message = "No route found for #{env["REQUEST_METHOD"]} #{env["PATH_INFO"]}"
  super(message)
end

Instance Attribute Details

#envHash (readonly)

Returns the Rack environment for the request.

Returns:

  • (Hash)

    the Rack environment for the request

Since:

  • 2.1.0



19
20
21
# File 'lib/hanami/extensions/router/errors.rb', line 19

def env
  @env
end