- auth: show detailed error message if Bolt couldn't initialize its DB

Close #1846

Squashed commit of the following:

commit 34c612852b784d78191b37577324adeb0149e789
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Jul 2 16:43:27 2020 +0300

    - auth: show detailed error message if Bolt couldn't initialize its DB
This commit is contained in:
Simon Zolin 2020-07-02 16:52:29 +03:00
parent 250b254c33
commit 72ce5f57c1

View File

@ -80,7 +80,10 @@ func InitAuth(dbFilename string, users []User, sessionTTL uint32) *Auth {
var err error
a.db, err = bbolt.Open(dbFilename, 0644, nil)
if err != nil {
log.Error("Auth: bbolt.Open: %s", err)
log.Error("Auth: open DB: %s: %s", dbFilename, err)
if err.Error() == "invalid argument" {
log.Error("AdGuard Home cannot be initialized due to an incompatible file system.\nPlease read the explanation here: https://github.com/AdguardTeam/AdGuardHome/wiki/Getting-Started#limitations")
}
return nil
}
a.loadSessions()