Browse Source

more error messages

pull/2/head
Chris Lu 12 years ago
parent
commit
7d8e9f829c
  1. 8
      weed-fs/src/pkg/operation/lookup.go

8
weed-fs/src/pkg/operation/lookup.go

@ -5,7 +5,8 @@ import (
"net/url"
"pkg/storage"
"pkg/util"
"fmt"
_ "fmt"
"errors"
)
type Location struct {
@ -17,11 +18,11 @@ type LookupResult struct {
Error string "error"
}
//TODO: Add a caching for vid here
func Lookup(server string, vid storage.VolumeId) (*LookupResult, error) {
values := make(url.Values)
values.Add("volumeId", vid.String())
jsonBlob, err := util.Post("http://"+server+"/dir/lookup", values)
fmt.Println("Lookup Result:", string(jsonBlob))
if err != nil {
return nil, err
}
@ -30,5 +31,8 @@ func Lookup(server string, vid storage.VolumeId) (*LookupResult, error) {
if err != nil {
return nil, err
}
if ret.Error != ""{
return nil, errors.New(ret.Error)
}
return &ret, nil
}
Loading…
Cancel
Save