NoTorrcErr typed error #10
|
@ -42,6 +42,13 @@ const (
|
|||
networkUp = 0
|
||||
)
|
||||
|
||||
// NoTorrcError is a typed error thrown to indicate start could not complete due to lack of a torrc file
|
||||
type NoTorrcError struct {
|
||||
path string
|
||||
}
|
||||
|
||||
func (e *NoTorrcError) Error() string { return fmt.Sprintf("torrc file does not exist at %v", e.path) }
|
||||
|
||||
type onionListenService struct {
|
||||
os *tor.OnionService
|
||||
tp *torProvider
|
||||
|
@ -286,8 +293,9 @@ func startTor(appDirectory string, bundledTorPath string, controlPort int, authe
|
|||
|
||||
// check if the torrc file is present where expected
|
||||
if _, err := os.Stat(path.Join(dataDir, "torrc")); os.IsNotExist(err) {
|
||||
log.Debugf("torrc file does not exist at %v", path.Join(dataDir, "torrc"))
|
||||
return nil, fmt.Errorf("torrc file does not exist at %v", path.Join(dataDir, "torrc"))
|
||||
err = &NoTorrcError{path.Join(dataDir, "torrc")}
|
||||
log.Debugln(err.Error())
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// if not, try running system tor
|
||||
|
|
Loading…
Reference in New Issue