Class: Hooks::Core::Failbot

Inherits:
Object
  • Object
show all
Defined in:
lib/hooks/core/failbot.rb

Overview

Global failbot component for error reporting

This is a stub implementation that does nothing by default. Users can replace this with their own implementation for services like Sentry, Rollbar, etc.

Instance Method Summary collapse

Instance Method Details

#capture(context = {}) ⇒ Object

Capture an exception during block execution

Parameters:

  • context (Hash) (defaults to: {})

    Optional context information

Returns:

  • (Object)

    Return value of the block



42
43
44
45
46
47
# File 'lib/hooks/core/failbot.rb', line 42

def capture(context = {})
  yield
rescue => e
  report(e, context)
  raise
end

#critical(error_or_message, context = {}) ⇒ void

This method returns an undefined value.

Report a critical error

Parameters:

  • error_or_message (Exception, String)

    Exception object or error message

  • context (Hash) (defaults to: {})

    Optional context information



25
26
27
# File 'lib/hooks/core/failbot.rb', line 25

def critical(error_or_message, context = {})
  # Override in subclass for actual error reporting
end

#report(error_or_message, context = {}) ⇒ void

This method returns an undefined value.

Report an error or exception

Parameters:

  • error_or_message (Exception, String)

    Exception object or error message

  • context (Hash) (defaults to: {})

    Optional context information



16
17
18
# File 'lib/hooks/core/failbot.rb', line 16

def report(error_or_message, context = {})
  # Override in subclass for actual error reporting
end

#warning(message, context = {}) ⇒ void

This method returns an undefined value.

Report a warning

Parameters:

  • message (String)

    Warning message

  • context (Hash) (defaults to: {})

    Optional context information



34
35
36
# File 'lib/hooks/core/failbot.rb', line 34

def warning(message, context = {})
  # Override in subclass for actual warning reporting
end