1
0
mirror of https://github.com/docker/cli.git synced 2026-01-22 03:22:01 +03:00

Merge branch 'master' into shykes-0.6.5-dm-plugin

Upstream-commit: 8a358e88339c7ba8606bab2c2f8877175bf55598
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-11-14 16:18:33 -08:00

View File

@@ -61,7 +61,10 @@ func parseMultipartForm(r *http.Request) error {
func httpError(w http.ResponseWriter, err error) {
statusCode := http.StatusInternalServerError
if strings.HasPrefix(err.Error(), "No such") {
// FIXME: this is brittle and should not be necessary.
// If we need to differentiate between different possible error types, we should
// create appropriate error types with clearly defined meaning.
if strings.Contains(err.Error(), "No such") {
statusCode = http.StatusNotFound
} else if strings.HasPrefix(err.Error(), "Bad parameter") {
statusCode = http.StatusBadRequest