Open darko-mijic opened 8 years ago
Hmm … the question is, is it necessary to add a general purpose field when you can just add it to any custom error type? Then you can also have more specific field names that make sense in the context.
@darko-mijic All up for standardising fields, maybe even as optional, but not keen on generic objects. What are the specific properties of these proposed 'data' objects?
My idea was to have optional object that will contain relevant data that caused the error. I was adding that to almost all my subclasses of Space.Error
(my custom error types). So the error presented to the client would include i18n message + data from the proposed field.
I think Space.Error needs a built in field of type
Object
to support encapsulation of invalid data.For i18n purposes name of the error class instance + data that is wrong (causing the error) can be enough to generate language specific error message.
I suggest adding something like this to default fields of Space.Error:
data: Match.Optional(Object)
Maybe the name of this field is not ideal.
What do you think @rhyslbw and @DominikGuzei?