Class: Exceptions::Backend

Inherits:
Object
  • Object
show all
Defined in:
lib/exceptions/backend.rb

Overview

Public: Backend is an abstract class that documents the interface for an exception tracking backend.

Instance Method Summary collapse

Instance Method Details

#clear_contextObject

Public: Clear should clear the context.

Returns nothing.



29
30
# File 'lib/exceptions/backend.rb', line 29

def clear_context
end

#context(ctx) ⇒ Object

Public: Context can be used to set global context.

ctx - A Hash of contextual information.

Returns nothing.



23
24
# File 'lib/exceptions/backend.rb', line 23

def context(ctx)
end

#notify(exception) ⇒ Object

Public: Notify should be implemented by classes that inherit from Backend to do something with the exception. Implementers of this interface can optionally return a Result object which can include things like an exception id from an external service.

exception - An Exception object. options - A Hash of options.

Returns an object satisfying the Result interface.

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/exceptions/backend.rb', line 14

def notify(exception)
  raise NotImplementedError
end

#rack_exception(exception, env) ⇒ Object

Public: Called by the Rack middleware when an exception is raised.

Returns and object satisfying the Result interface.



35
36
37
# File 'lib/exceptions/backend.rb', line 35

def rack_exception(exception, env)
  notify(exception)
end