Answer the question
In order to leave comments, you need to log in
Passing Errors With Api?
Hello. Tell me please. What is the best way to organize the transmission of business logic errors. For example, if the user is not authenticated, or not found at all, or there are no access rights ... well, there may be a lot of conditions? Send code in response body:
200 { status: false, error: user not found', code: 'свой код ошибки' }
Answer the question
In order to leave comments, you need to log in
Respond with the appropriate http code and return a string or json with the detailed error text in the body.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question