returning error codes

Options
I was looking at some references on how to return error codes. I noticed pre-conditions have fields for error_message; not sure how to use these. Further, I tried to create using utility response to create status variables to return codes but could not see how to do so. Not sure what the best scheme is of detecting errors, does one then set some variables, then how to use it in return of responses. Here are a couple of references i saw.

https://docs.xano.com/api/the-basics/api-status-codes
https://community.xano.com/c/apis/returning-a-response-code