Harbinger

Version Build Status Code Climate Coverage Status API Docs APACHE 2 License

A Rails engine for arbitrary message creation and delivery.

Installation

Add this line to your application's Gemfile:

gem 'blorg'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blorg

Usage

class PagesController
  def show
    @page = Page.find(params[:id])
  rescue ActiveRecord::RecordNotFound => exception
    Harbinger.call(
      channels: [:database, :logger],
      reporters: [exception, current_user, request]
    )
  end
end

Given the above Rails-like code When a user attempts to find a page that does not exist Then an exception is raised And the Harbinger.call code will:

  • Build a message based on the three reporters:
    • The raised exception
    • The current user
    • The request
  • Deliver that message to the two channels:
    • Database
    • Logger

For further details I recommend delving into the end to end exception handling spec

Extending Contexts and Channels

Harbinger is built to allow for easy creation of new Contexts and Channels.