Class: AWS::SessionStore::DynamoDB::Errors::BaseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/session_store/dynamo_db/errors/base_handler.rb

Overview

BaseErrorHandler provides an interface for error handlers that can be passed in to RackMiddleware. Each error handler must implement a handle_error method.

Examples:

Sample ErrorHandler class

class MyErrorHandler < BaseErrorHandler
 # Handles error passed in
 def handle_error(e, env = {})
   File.open(path_to_file, 'w') {|f| f.write(e.message) }
   false
 end
end

Direct Known Subclasses

DefaultHandler

Instance Method Summary collapse

Instance Method Details

#handle_error(error, env = {}) ⇒ false

An error and an environment (optionally) will be passed in to this method and it will determine how to deal with the error. Must return false if you have handled the error but are not reraising the error up the stack. You may reraise the error passed.

Parameters:

  • error (AWS::DynamoDB::Errors::Base)

    error passed in from AWS::SessionStore::DynamoDB::RackMiddleware.

  • env (Rack::Request::Environment, nil) (defaults to: {})

    Rack environment

Returns:

  • (false)

    If exception was handled and will not reraise exception.

Raises:

  • (AWS::DynamoDB::Errors)

    If error has be reraised.



41
42
43
# File 'lib/aws/session_store/dynamo_db/errors/base_handler.rb', line 41

def handle_error(error, env = {})
  raise NotImplementedError
end