Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
Kenneth Kalmer edited this page May 7, 2011 · 5 revisions

Safely is a project extracted from the daemon-kit project that allows you to run dangerous code inside a loving embrace. All exceptions will be reported using one of the configured strategies and your Ruby process will be kept alive in the future.

Installation

Safely itself has no dependencies, you simply install the 'safely' gem or add it to your Gemfile. Each strategy you choose to use for reporting exceptions might require their own dependencies.

Strategies

Safely comes bundled with a Hoptoad, Mail and Log strategy. Each strategy is configured on their own, and has their own dependencies in order to be useful.

Usage

Once the gem has been required, and the strategies configured, you simply make use of it as follows:

  safely do
    perform_dangerous_operation
  end

The safely method is available in any Ruby context.

Backtraces

Since 0.3, Safely supports logging all exceptions to a file when a Ruby program terminates abnormally. This is extremely useful when your program suddenly falls over and you have no idea why. For more information see the Backtrace page.

Clone this wiki locally