4 ms·
Wow I've been programming Ruby for 15 years and didn't know `rescue` uses a match operator. It's annoying when a library raises only one exception type for eve
by caseyohara 3y ago
Wow I've been programming Ruby for 15 years and didn't know `rescue` uses a match operator.
It's annoying when a library raises only one exception type for every error and the only difference is in the message. Matching on the message right in the rescue expression would be tremendously useful instead of parsing the message and deciding how to deal with it inside the rescue body.
- djur 3y agoHere's the library: https://github.com/mboeh/toe_tag https://github.com/mboeh/toe_tag It's a decade old and less than 100 lines so it might be more useful as an example than a gem. The last time I needed to do something like this I just rewrote the parts I needed. The ecosystem is just generally better about exceptions than it used to be, too.