Module: Hyde::DSL::CommonMethods

Included in:
ProbeContext, ProcessorContext, TemplateContext
Defined in:
lib/hyde/dsl/methods_common.rb

Overview

Methods shared by probes, preprocessors and filters.

Instance Method Summary collapse

Instance Method Details

#bounceObject

Bounce request to the next handler

Raises:

  • (UncaughtThrowError)

    throws :break to get out of the callback



23
24
25
# File 'lib/hyde/dsl/methods_common.rb', line 23

def bounce
  throw :break
end

#die(errorcode, backtrace: nil) ⇒ Object

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



11
12
13
14
15
16
17
18
19
# File 'lib/hyde/dsl/methods_common.rb', line 11

def die(errorcode, backtrace: nil)
  throw :finish, [errorcode].append(
    *(@origin.properties["handle.#{errorcode}"] or
      @origin.properties["handle.default"]).call(
        errorcode,
        backtrace: backtrace
      )
  )
end