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
- Host: GitHub
- URL: https://github.com/sshaw/angry_raise
- Owner: sshaw
- License: mit
- Created: 2018-02-25T07:39:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-20T20:35:33.000Z (over 4 years ago)
- Last Synced: 2024-04-26T13:20:17.277Z (about 1 year ago)
- Topics: dsl, error-handling, error-messages, errors, exceptions, raise, ruby
- Language: Ruby
- Homepage:
- Size: 7.81 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# AngryRaise
[](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