title: How to determine what kind of error message I should return from golang API?
body: <p>I have a GoLang API with an SPA to consume it. What I do to errors in my API is return them until the handler where I test if an error from previous functions exist. If there is an error, I put it inside the response body, set status code to either 400 or 500 then return the response</p>
  
  <p>in the handler function, to be able to create a clear message to the client side, I need to know what kind of error was returned, how do I do it?</p>
  
  <p>I know about error types but I read about Dave Cheney's recommendation to just return an error along with a message (or wrap them in other words).</p>
  
  <p>But if there are so many kinds of errors which might occur in the API call, then does it mean before returning the response, I need to check them all just to know what message I should return?</p>