func ErrorResponse(w http.ResponseWriter, err ErrorData) {
  responseData, jsonerr := json.Marshal(err)

  if jsonerr != nil {
    http.Error(w, "error processing error json", 500)
  }

  w.Header().Set("Content-Type", "application/json")
  w.WriteHeader(err.Code)
  w.Write(responseData)
}
// ErrorResponse uses an ErrorData struct, which is converted to JSON, to send error
// data back to the client.
ErrorResponse uses an ErrorData struct, which is converted to JSON, to send error
data back to the client.
// ErrorResponse uses an ErrorData struct which is converted to JSON to send error // data back to the client .
func ErrorResponse(w http.ResponseWriter, err ErrorData) {
  responseData, jsonerr := json.Marshal(err)
  if jsonerr != nil {
    http.Error(w, "error processing error json", 500)
  }
  w.Header().Set("Content-Type", "application/json")
  w.WriteHeader(err.Code)
  w.Write(responseData)
}
func ErrorResponse ( w http . ResponseWriter , err ErrorData ) { responseData , jsonerr := json . Marshal ( err ) if jsonerr != nil { http . Error ( w , " " , 500 ) } w . Header ( ) . Set ( " " , " " ) w . WriteHeader ( err . Code ) w . Write ( responseData ) }
ErrorResponse uses an ErrorData struct, which is converted to JSON, to send error
data back to the client.
ErrorResponse uses an ErrorData struct which is converted to JSON to send error data back to the client .