AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

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