Class: Grape::Middleware::Error::Options

Inherits:
Data
  • Object
show all
Includes:
DeprecatedOptionsHashAccess
Defined in:
lib/grape/middleware/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DeprecatedOptionsHashAccess

#[]

Constructor Details

#initialize(all_rescue_handler: nil, base_only_rescue_handlers: nil, content_types: nil, default_error_formatter: nil, default_message: '', default_status: 500, error_formatters: nil, format: :txt, grape_exceptions_rescue_handler: nil, internal_grape_exceptions_rescue_handler: nil, rescue_all: false, rescue_grape_exceptions: false, rescue_handlers: nil, rescue_options: nil) ⇒ Options

Returns a new instance of Options.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/grape/middleware/error.rb', line 18

def initialize(
  all_rescue_handler: nil, base_only_rescue_handlers: nil, content_types: nil,
  default_error_formatter: nil, default_message: '', default_status: 500,
  error_formatters: nil, format: :txt,
  grape_exceptions_rescue_handler: nil, internal_grape_exceptions_rescue_handler: nil,
  rescue_all: false, rescue_grape_exceptions: false, rescue_handlers: nil,
  rescue_options: nil
)
  # `rescue_options:` arrives nil from `Endpoint#error_middleware_options`
  # when no `rescue_from` has been called — fall back to the documented
  # defaults rather than letting nil propagate to `def_delegator
  # :rescue_options, :backtrace`.
  rescue_options ||= Grape::DSL::RescueOptions.new
  super
end

Instance Attribute Details

#all_rescue_handlerObject (readonly)

Returns the value of attribute all_rescue_handler

Returns:

  • (Object)

    the current value of all_rescue_handler



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def all_rescue_handler
  @all_rescue_handler
end

#base_only_rescue_handlersObject (readonly)

Returns the value of attribute base_only_rescue_handlers

Returns:

  • (Object)

    the current value of base_only_rescue_handlers



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def base_only_rescue_handlers
  @base_only_rescue_handlers
end

#content_typesObject (readonly)

Returns the value of attribute content_types

Returns:

  • (Object)

    the current value of content_types



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def content_types
  @content_types
end

#default_error_formatterObject (readonly)

Returns the value of attribute default_error_formatter

Returns:

  • (Object)

    the current value of default_error_formatter



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def default_error_formatter
  @default_error_formatter
end

#default_messageObject (readonly)

Returns the value of attribute default_message

Returns:

  • (Object)

    the current value of default_message



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def default_message
  @default_message
end

#default_statusObject (readonly)

Returns the value of attribute default_status

Returns:

  • (Object)

    the current value of default_status



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def default_status
  @default_status
end

#error_formattersObject (readonly)

Returns the value of attribute error_formatters

Returns:

  • (Object)

    the current value of error_formatters



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def error_formatters
  @error_formatters
end

#formatObject (readonly)

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def format
  @format
end

#grape_exceptions_rescue_handlerObject (readonly)

Returns the value of attribute grape_exceptions_rescue_handler

Returns:

  • (Object)

    the current value of grape_exceptions_rescue_handler



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def grape_exceptions_rescue_handler
  @grape_exceptions_rescue_handler
end

#internal_grape_exceptions_rescue_handlerObject (readonly)

Returns the value of attribute internal_grape_exceptions_rescue_handler

Returns:

  • (Object)

    the current value of internal_grape_exceptions_rescue_handler



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def internal_grape_exceptions_rescue_handler
  @internal_grape_exceptions_rescue_handler
end

#rescue_allObject (readonly)

Returns the value of attribute rescue_all

Returns:

  • (Object)

    the current value of rescue_all



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def rescue_all
  @rescue_all
end

#rescue_grape_exceptionsObject (readonly)

Returns the value of attribute rescue_grape_exceptions

Returns:

  • (Object)

    the current value of rescue_grape_exceptions



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def rescue_grape_exceptions
  @rescue_grape_exceptions
end

#rescue_handlersObject (readonly)

Returns the value of attribute rescue_handlers

Returns:

  • (Object)

    the current value of rescue_handlers



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def rescue_handlers
  @rescue_handlers
end

#rescue_optionsObject (readonly)

Returns the value of attribute rescue_options

Returns:

  • (Object)

    the current value of rescue_options



9
10
11
# File 'lib/grape/middleware/error.rb', line 9

def rescue_options
  @rescue_options
end