Is there a way to create a ErrorAPI class to handl...
# android
a
Is there a way to create a ErrorAPI class to handle the error response?
Copy code
{
  "error": {
    "name": [
      "The name field is required."
    ],
    "email": [
      "The email field is required."
    ],
    "password": [
      "The password field is required."
    ]
  }
}
g
I would say this API is really poorly designed
👍 4
j
are you using gson or moshi?
because you could write an error adapter
g
You could of course, on gson and on moshi, it’s more about writing adapter that fits all possible error responses which also could be possible to use on runtime (Sealed class?)