mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
cleaner error message
This commit is contained in:
parent
46d13f6b5e
commit
33d5778a46
|
@ -99,7 +99,9 @@ func GetHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Println("read bytes", count, "error", e)
|
log.Println("read bytes", count, "error", e)
|
||||||
}
|
}
|
||||||
if e != nil || count <= 0 {
|
if e != nil || count <= 0 {
|
||||||
log.Println("read error:", e)
|
if *IsDebug {
|
||||||
|
log.Println("read error:", e, r.URL.Path)
|
||||||
|
}
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -142,7 +144,6 @@ func PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}) {
|
}) {
|
||||||
ret = 0
|
ret = 0
|
||||||
errorStatus = "Failed to write to replicas for volume " + volumeId.String()
|
errorStatus = "Failed to write to replicas for volume " + volumeId.String()
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -152,6 +153,10 @@ func PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if errorStatus == "" {
|
if errorStatus == "" {
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
} else {
|
} else {
|
||||||
|
store.Delete(volumeId, needle)
|
||||||
|
distributedOperation(volumeId, func(location operation.Location) bool {
|
||||||
|
return nil == operation.Delete("http://"+location.Url+r.URL.Path+"?type=standard")
|
||||||
|
})
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
m["error"] = errorStatus
|
m["error"] = errorStatus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -105,5 +105,5 @@ func (v *Volume) read(n *Needle) (int, error) {
|
||||||
v.dataFile.Seek(int64(nv.Offset)*8, 0)
|
v.dataFile.Seek(int64(nv.Offset)*8, 0)
|
||||||
return n.Read(v.dataFile, nv.Size)
|
return n.Read(v.dataFile, nv.Size)
|
||||||
}
|
}
|
||||||
return -1, io.EOF
|
return -1, errors.New("Not Found")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue