Skip to content

Instantly share code, notes, and snippets.

@candidosales
Last active April 26, 2018 17:34
Show Gist options
  • Save candidosales/3f0d2cdb0c953183c9e3142d6609c35e to your computer and use it in GitHub Desktop.
Save candidosales/3f0d2cdb0c953183c9e3142d6609c35e to your computer and use it in GitHub Desktop.
Como tratar os erros
// {
// "id": 4,
// "name": "Nikola Tesla",
// "branch": "0001",
// "branchVerificationDigit": "string",
// "account": "1256720",
// "accountVerificationDigit": 3,
// "phone": "11 95555-5555",
// "email": "nikola@tesla.com",
// "apiMetadata": {
// "type": "AccountInfo",
// "meta": {},
// "jsonapi": {
// "version": "1.0"
// },
// "errors": [
// {
// "type": "ConstraintViolationException",
// "message": "You must fill the 'name' field",
// "meta": "accountInfo.name"
// }
// ],
// "included": {},
// "timestamp": "2018-04-04T11:32:16.497Z"
// }
// }
class ResponseError(val type: String = "",
val message: String = "",
val meta: String = "")
class ApiMetadata(val type: String = "",
val errors: MutableList<ResponseError>,
val timestamp: String = "")
open class Response(val apiMetadata: ApiMetadata? = null)
// O que sera colocado no service do Retrofit
data class ExtractRaw(val balance: Int): Response()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment