(w http.ResponseWriter, r *http.Request, err error)
| 48 | } |
| 49 | |
| 50 | func handleError(w http.ResponseWriter, r *http.Request, err error) { |
| 51 | switch e := err.(type) { |
| 52 | case notFoundError: |
| 53 | http.NotFound(w, r) |
| 54 | case interface{ StatusCode() int }: |
| 55 | http.Error(w, err.Error(), e.StatusCode()) |
| 56 | default: |
| 57 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 58 | } |
| 59 | } |
no test coverage detected