An open API service indexing awesome lists of open source software.

https://github.com/sshaw/angry_raise

raise Ruby exceptions, with emotion and intensity
https://github.com/sshaw/angry_raise

dsl error-handling error-messages errors exceptions raise ruby

Last synced: 6 months ago
JSON representation

raise Ruby exceptions, with emotion and intensity

Awesome Lists containing this project

README

        

# AngryRaise

[![Build Status](https://travis-ci.org/sshaw/angry_raise.svg?branch=master)](https://travis-ci.org/sshaw/angry_raise)

`raise` exceptions, with emotion and intensity

## Usage

```rb
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](https://youtu.be/rHimCElPNPU):

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

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

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

## Internationalization

```rb
I18n.locale = :es
raise!!! "tenemos un problema aqui" # ¡¡¡Tenemos Un 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 exact opposite of their default implementations!** So, I'd say NO!!!!

## Author

Skye Shaw [skye.shaw =AT= gmail]

## See Also

* [Acme::Crap](https://metacpan.org/pod/Acme::Crap) - The Perl module that served as inspiration
* [Table flipper](https://github.com/iridakos/table_flipper) - Prepends the table flipper on Exception messages
* [class2](https://github.com/sshaw/class2) - DSL for creating class hierarchies
* [YYMMDD](https://github.com/sshaw/yymmdd) - Tiny DSL for idiomatic date parsing and formatting