more updates

Former-commit-id: 8c19eda25f
This commit is contained in:
Henrique Dias
2017-06-19 18:23:57 +01:00
parent 8d4981fcb8
commit bd7184d5df
16 changed files with 79 additions and 83 deletions

View File

@@ -1,24 +0,0 @@
package filemanager
import (
"net/http"
"os"
)
// errorToHTTPCode converts errors to HTTP Status Code.
func errorToHTTPCode(err error, gone bool) int {
switch {
case os.IsPermission(err):
return http.StatusForbidden
case os.IsNotExist(err):
if !gone {
return http.StatusNotFound
}
return http.StatusGone
case os.IsExist(err):
return http.StatusGone
default:
return http.StatusInternalServerError
}
}