InternalServerError: template.Must(template.New("").Parse("{{define \"base\"}}<html><head><title>500</title></head><body><p>Internal server error.</p></body></html>{{end}}")),
+func (h *Handler) handleOAuthError(w http.ResponseWriter, r *http.Request, err error) {
+ if err == nil {
+ return
+ }
+
+ if err, ok := err.(impart.HTTPError); ok {
+ if err.Status >= 300 && err.Status < 400 {
+ sendRedirect(w, err.Status, err.Message)
+ return
+ }
+
+ impart.WriteOAuthError(w, err)
+ return
+ }
+
+ impart.WriteOAuthError(w, impart.HTTPError{http.StatusInternalServerError, "This is an unhelpful error message for a miscellaneous internal error."})