concordia-publishing-house/idioms — pull request #4 by boblail (2014-11-18 16:18:48+00:00)
Title: Gave `Date.parse` and `Time.parse` better errors

`Date.parse "Nov 0 2014"` raises `ArgumentError` — which is really vague and annoying if you're several stack frames away from the origin of the error. Should you rescue from _all_ `ArgumentError`s? Maybe not!

If the method parsing the date or time isn't necessarily the one that should rescue from the exception, such a generic error is hard to work with.

This idiom introduces `Date.parse!` and `Time.parse!` that raise `Idioms::InvalidDate` and `Idioms::InvalidTime` respectively _rather than_ `ArgumentError` (although those two new exception classes inherit from `ArgumentError` so that the `parse!` methods can be used interchangeably with the standard library's `parse` method.