Continuing the discussion from Improve domain validation error to be more human readable:
The clients can show a human readable message when a domain is not valid (most of the case). But when the domain validation is done on the server side, the user only get a generic error message. It would give a better experience if the message could include the human readable message from the client.
DomainValidationError, we take the first invalid record and evaluate with the
domain_inversion method (the file
tryton/common/domain_inversion.py could be copied from the client to the server as it depends only from Python stdlib) using the
EvalEnvironment (which is compatible). The resulted inverted domain is send to the client as an extra parameter of the exception with the fields (from
fields_get call). The client can use those extra parameters to instantiate a
DomainParser and convert the domain into a string. This string will be appended to the error message.