From 7d8e9f829c11dd8151144e20506e673d2f3b9d27 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 20 Sep 2012 02:53:23 -0700 Subject: [PATCH] more error messages --- weed-fs/src/pkg/operation/lookup.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/weed-fs/src/pkg/operation/lookup.go b/weed-fs/src/pkg/operation/lookup.go index fa5f149a1..720286c31 100644 --- a/weed-fs/src/pkg/operation/lookup.go +++ b/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 }