I already have a lot of questions that are related to one not very big project, those who most of them saw began to draw a general picture of the entire program, but I had one difficulty while working with the server answers. The logic on the server is as simple as possible and does not require verification, everything is tied to the correctness of the request and its parameters. My application quite actively communicates with the server, receives and sends data. The whole process of communicating with the server comes down to the fact that I request something and the server sends the answer, and this answer can be both satisfactory (200) and unsatisfactory (400,401,403). In the first case, I already sort of figured out how and what to create, and how to pull out the data I needed from the server’s response, but I don’t really understand how to specify the unsatisfactory answer. For example, I receive a response from the server:
Code: 400 Bad Request Content: { "error_code": 7, "message": "no_token_given" } or this:
Code: 401 Unauthorized Content: { "error_code": 8, "message": "refresh_token_expired" } shorter than a bunch of options there. This question was asked in order to understand how the program will understand what negative answer came, because it is one of many. At the moment I want to solve the problem with access_token swelling, in order to update it, I need to send a request to update the token, and in order to send such a request, I need to receive such an answer first:
Code: 401 Unauthorized Content: { "error_code": 3, "message": "access_token_expired" } everything seems to be clear in my code, there is onResponce or onFailure, but I cannot understand which of these functions should be used to process negative answers, so that when a response comes for a token, I could send my request to a new one. If someone understood the essence of my question and can help me, then I will be very happy to hear your opinion.