mirror of
https://github.com/bronson-g/baseball-api.git
synced 2025-12-24 05:07:42 -05:00
13 lines
218 B
Go
13 lines
218 B
Go
package util
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
)
|
|
|
|
func ErrorResponse(err error, w http.ResponseWriter) {
|
|
if err != nil {
|
|
w.Write([]byte("{\"error\":\"" + strings.Replace(err.Error(), "\"", "\\\"", -1) + "\"}"))
|
|
}
|
|
}
|