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

Ayden

06/30/2018, 2:00 PM
Copy code
{
  "status": false,
  "message": "Duplicate entry '@gmail.com' for key 'users_email_unique'"
}
Copy code
{
  "status": false,
  "message": {
    "code": "1048",
    "message": "Something goes wrong."
  }
}
g

gildor

06/30/2018, 2:02 PM
It's not easy to handle such inconsistent API. But if you cannot fix this on server side... You can use some sort dynamic API (like parse to Map<Any, Any>)
Or use multi-step parsing to parse to corresponding error class, but still should check type on runtime
r

rkeazor

06/30/2018, 2:12 PM
You would have to parse the json and check for the error body.Yea I agree API like this are annoying. They should just fail with a error code if something is wrong
But anyway, this is not in the scope of the chat lol.Wee I always tell you, Kotlin specific lol
a

Ayden

06/30/2018, 4:29 PM
@rkeazoraw! I'm so sorry Robert. 😞 I will be extra careful next time. My apologise.
@gildor thanks Andrey, definitely will try it out!
r

rkeazor

06/30/2018, 4:41 PM
no need to apologize to me, i’m just reiterating the the channel rules lol. sooner or later we are going to have rename this channel to the slackoverflow channelstackoverflow🤦‍♀️
😂 2
😫 2