AngryRaise

Build Status

raise exceptions, with emotion and intensity

Usage

require "angry_raise"

raise! "an error occured"                   # "RuntimeError: an error occured!"
raise! SomeError, "an error occured"        # "SomeError: an error occured!"
raise! SomeError.new("an error occured")    # "SomeError: an error occured!"

raise!! "an error occured"                  # "RuntimeError: An error occured!!"
raise!! SomeError, "an error occured"       # "SomeError: An error occured!!"
raise!! SomeError.new("an error occured")   # "SomeError: An error occured!!"

raise!!! "an error occured"                 # "RuntimeError: An Error Occured!!!"
raise!!! SomeError, "an error occured"      # "SomeError: An Error Occured!!!"
raise!!! SomeError.new("an error occured")  # "SomeError: An Error Occured!!!"

raise!!!! "an error occured"                # "RuntimeError: AN ERROR OCCURED!!!!"
raise!!!! SomeError, "an error occured"     # "SomeError: AN ERROR OCCURED!!!!"
raise!!!! SomeError.new("an error occured") # "SomeError: AN ERROR OCCURED!!!!"

Feel free to capture the mood of each caller:

raise!!!!!!!!!!!!!! "an error occured"  # RuntimeError: AN ERROR OCCURED!!!!!!!!!!!!!!

You can add a backtrace too, because sometimes, it's appropriate:

raise!!! SomeError, "an error occured", %w[frame1 frame2 frame3]

Internationalization

I18n.locale = :es
raise!!! "tenemos una problema aqui"  # ¡¡¡Tenemos Una Problema Aqui!!!

Currently only supports Spanish. Is there any other language to support?

Can I Use This in Production?

Should one ever use monkey patched code in production‽‽‽

This library changes the behavior or String#!, Exception#! and Exception::! to the the exact opposite of their default implementations! So, I'd say NO!!!!

Author

Skye Shaw [skye.shaw =AT= gmail]

See Also

  • Acme::Crap - The Perl module that served as inspiration
  • Table flipper - Prepends the table flipper on Exception messages
  • class2 - DSL for creating class hierarchies
  • YYMMDD - Tiny DSL for idiomatic date parsing and formatting