https://kotlinlang.org logo
#android
Title
# android
a

Ayden

06/30/2018, 1:45 PM
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

gildor

06/30/2018, 2:04 PM
I would say this API is really poorly designed
👍 4
j

James

07/02/2018, 1:33 AM
are you using gson or moshi?
because you could write an error adapter
g

gildor

07/02/2018, 1:38 AM
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?)