Skip to content

Instantly share code, notes, and snippets.

@boopathi
Created November 26, 2013 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boopathi/7666107 to your computer and use it in GitHub Desktop.
Save boopathi/7666107 to your computer and use it in GitHub Desktop.
Error Adapter - Go
func errorAdapter(f func(http.ResponseWriter, *http.Request) error) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
err := f(w, r)
if err != nil {
c.Errorf("Handler returned an error: %s", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment