t6d/smart_properties — pull request #7 by fabrik42 (2014-07-29 15:03:39+00:00)
Title: Use custom ArgumentError exception with metadata

I want to use smart properties to validate/sanitize hashes. However, if this is connected to a user facing interface, you usually want to provide some kind of feedback, when the property interfaces are not satisfied.

So I added a custom exception class, called `SmartProperties::ArgumentError`, that has an additional property called `errors`. It contains a hash of the structure `invalid_field => error explanation` that can be used e.g. for rendering a JSON error response.

Please note that `SmartProperties::ArgumentError` inherits from `ArgumentError` to keep backwards compatibility.

Cheers!