commit 468cd4bde80419824beb20d02c32315f46288d13 Author: Yawning Angel yawning@torproject.org Date: Wed Aug 27 03:52:22 2014 +0000
Display a more useful error on JSON Unmarshall failure. --- transports/obfs4/statefile.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/transports/obfs4/statefile.go b/transports/obfs4/statefile.go index 378eefa..7949dd9 100644 --- a/transports/obfs4/statefile.go +++ b/transports/obfs4/statefile.go @@ -98,7 +98,8 @@ func serverStateFromJSONServerState(js *jsonServerState) (*obfs4ServerState, err }
func jsonServerStateFromFile(stateDir string, js *jsonServerState) error { - f, err := ioutil.ReadFile(path.Join(stateDir, stateFile)) + fPath := path.Join(stateDir, stateFile) + f, err := ioutil.ReadFile(fPath) if err != nil { if os.IsNotExist(err) { if err = newJSONServerState(stateDir, js); err == nil { @@ -109,7 +110,7 @@ func jsonServerStateFromFile(stateDir string, js *jsonServerState) error { }
if err = json.Unmarshal(f, js); err != nil { - return err + return fmt.Errorf("failed to load statefile '%s': %s", fPath, err) }
return nil
tor-commits@lists.torproject.org