Add support for getting errors as an object.

This implements a way to get error messages back as an object, instead of a flat array of strings, where the object properties are the field names, and the object values are the corresponding arrays of error messages for that field.

This is useful if you want to associate each message back to it's related field.

See the unit tests for example.