[Pkg-privacy-commits] [obfs4proxy] 90/151: Display a more useful error on JSON Unmarshall failure.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:59:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository obfs4proxy.
commit 468cd4bde80419824beb20d02c32315f46288d13
Author: Yawning Angel <yawning at 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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfs4proxy.git
More information about the Pkg-privacy-commits
mailing list