I want to read error message using Retrofit. I have tried errorbody.message() and errorBody().string.
Error message Postman Screenshot
Am able to print error message when use errorBody().string() but when append to Toast, its returning empty message. Can anyone help, to fix this?
println("errr,,,,,,," + response.errorBody()!!.string()) // output Middle name mst provide
println("errr,,,,,,," + response.errorBody()!!.toString()) //Response{protocol=h2, code=400, message=, url="myurl"}
Toast.makeText(context,response.errorBody()!!.string(),Toast.LENGTH_SHORT).show()