On 01/08/2012 04:57 AM, Thomas Sawyer wrote: > I've come across this from time to time, where some piece of complex > data, often (but not always) loaded from a file, doesn't conform to > some set of validation requirements. I've never been quite sure what > type of error to throw if the data doesn't conform. It's not exactly > an ArgumentError, it's more complex then that and not necessarily > coming in via method arguments, nor is it exactly a TypeError since > it's not necessarily anything to do with a specific class. So I find > myself falling back to Runtime error and rolling my own, but thinking > it would be nice if there were a general purpose `ValidationError` to > raise or subclass in these cases. Why not subclass Syntax error, and put the class in a namespace belonging to your particular validation requirements? This is more or less what YAML does.