hello this is my code and why I cant get message like "The value is already exist" ? why retrofit return null message in response with status 500?
call.enqueue(object : Callback<Person> {
override fun onResponse(call: Call<Person>, response: Response<Person>) {
if (!response.isSuccessful) {
Log.e(ContentValues.TAG, "Code: " + response.message())
Toast.makeText(context, response.toString(), Toast.LENGTH_LONG).show()
} else {
pr = response.body()!!
init(view)
}
}
override fun onFailure(call: Call<Person>, t: Throwable) {
Log.e(ContentValues.TAG, "fauilure " + t.message)
Toast.makeText(context, t.message, Toast.LENGTH_LONG).show()
}
}
this is my response from debugger (retrofit)
Response{protocol=http/1.1, code=500, message=, url=http://192.168.1.239:8080/person/}
and this is my server response (from postman)
{"timestamp":"2021-02-21T12:50:35.222+00:00","status":500,"error":"Internal Server Error","message":"The value is already exist","path":"/person/"}