Module: Landline::DSL::CommonMethods

Included in:
App, ProcessorContext, TemplateContext
Defined in:
lib/landline/dsl/methods_common.rb

Overview

Methods shared by probes, preprocessors and filters.

Instance Method Summary collapse

Instance Method Details

#bounceObject

(in Landline::Probe context) Bounce request to the next handler

Raises:

  • (UncaughtThrowError)

    throws :break to get out of the callback



28
29
30
# File 'lib/landline/dsl/methods_common.rb', line 28

def bounce
  throw :break
end

#die(errorcode, backtrace: nil, error: nil) ⇒ Object

(in Landline::Probe context) Stop execution and generate a boilerplate response with the given code

Parameters:

  • errorcode (Integer)
  • backtrace (Array(String), nil) (defaults to: nil)

Raises:

  • (UncaughtThrowError)

    throws :finish to return back to Server



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/landline/dsl/methods_common.rb', line 12

def die(errorcode, backtrace: nil, error: nil)
  response = Landline::Response.convert(
    (@origin.properties["handle.#{errorcode}"] or
     @origin.properties["handle.default"]).call(
       errorcode,
       backtrace: backtrace,
       error: error
     )
  )
  response.status = errorcode if response.status == 200
  throw :finish, response
end