From f41f2b823aaacfa0173e566b5c1f96d63cb572bb Mon Sep 17 00:00:00 2001 From: davy wybiral Date: Thu, 8 Aug 2019 05:08:29 -0500 Subject: [PATCH] tor error msgs (#17) --- pkg/app/app.go | 3 ++- pkg/app/tor.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/app/app.go b/pkg/app/app.go index 57c0aa4..7199c84 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -2,6 +2,7 @@ package app import ( + "errors" "fmt" "html/template" "log" @@ -101,7 +102,7 @@ func (a *App) Run() error { onion.Ports[80] = fmt.Sprintf("%s:%d", cs.Host, cs.Port) err = a.Tor.Controller.AddOnion(onion) if err != nil { - return err + return errors.New("unable to start Tor onion service") } log.Printf("Onion service: http://%s.onion", onion.ServiceID) } diff --git a/pkg/app/tor.go b/pkg/app/tor.go index 88f2db2..d06751f 100644 --- a/pkg/app/tor.go +++ b/pkg/app/tor.go @@ -1,6 +1,7 @@ package app import ( + "errors" "fmt" "os" @@ -17,7 +18,7 @@ func newTor(ct *TorConfig) (*tor, error) { addr := fmt.Sprintf("%s:%d", ct.Controller.Host, ct.Controller.Port) ctrl, err := torgo.NewController(addr) if err != nil { - return nil, err + return nil, errors.New("unable to connect to Tor controller") } if len(ct.Controller.Password) > 0 { err = ctrl.AuthenticatePassword(ct.Controller.Password) @@ -28,7 +29,7 @@ func newTor(ct *TorConfig) (*tor, error) { } } if err != nil { - return nil, err + return nil, errors.New("unable to authenticate to Tor controller") } key, err := onionkey.ReadFile("onion.key") if os.IsNotExist(err) {