mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
more error messages
This commit is contained in:
parent
462f2ed958
commit
7d8e9f829c
|
@ -5,7 +5,8 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"pkg/storage"
|
"pkg/storage"
|
||||||
"pkg/util"
|
"pkg/util"
|
||||||
"fmt"
|
_ "fmt"
|
||||||
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Location struct {
|
type Location struct {
|
||||||
|
@ -17,11 +18,11 @@ type LookupResult struct {
|
||||||
Error string "error"
|
Error string "error"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Add a caching for vid here
|
||||||
func Lookup(server string, vid storage.VolumeId) (*LookupResult, error) {
|
func Lookup(server string, vid storage.VolumeId) (*LookupResult, error) {
|
||||||
values := make(url.Values)
|
values := make(url.Values)
|
||||||
values.Add("volumeId", vid.String())
|
values.Add("volumeId", vid.String())
|
||||||
jsonBlob, err := util.Post("http://"+server+"/dir/lookup", values)
|
jsonBlob, err := util.Post("http://"+server+"/dir/lookup", values)
|
||||||
fmt.Println("Lookup Result:", string(jsonBlob))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -30,5 +31,8 @@ func Lookup(server string, vid storage.VolumeId) (*LookupResult, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if ret.Error != ""{
|
||||||
|
return nil, errors.New(ret.Error)
|
||||||
|
}
|
||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue