Comment 1 for bug 526721

Revision history for this message
dirk (australiandeveloper) wrote :

This is still not quite right - the problem is that when the Error object is converted to JSON, the message is translated, so the error code is lost.

For example if the error was
message: validation.maxSize
key: provider.description
variables ["1024"]

Then when the Error object is created it will translate message into something like "The provider.description is more than 1024 chars".
So the resulting JSON will have the translated message:
{
  message: "The provider.description is more than 1024 chars",
  key: provider.description
  variables ["1024"]
}

It would be nice to preserve the original error code as well, so that the client can take a different action depending on the type of error:
{
  code: "validation.maxSize",
  message: "The provider.description is more than 1024 chars",
  key: provider.description
  variables ["1024"]
}