Error out when storing unsupported SASL mechanism in DB

This commit is contained in:
Simon Ser 2020-03-25 14:15:25 +01:00
parent 63db290229
commit 02c3bdde20
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

3
db.go
View File

@ -2,6 +2,7 @@ package soju
import (
"database/sql"
"fmt"
"sync"
_ "github.com/mattn/go-sqlite3"
@ -163,6 +164,8 @@ func (db *DB) StoreNetwork(username string, network *Network) error {
case "PLAIN":
saslPlainUsername = toStringPtr(network.SASL.Plain.Username)
saslPlainPassword = toStringPtr(network.SASL.Plain.Password)
default:
return fmt.Errorf("soju: cannot store network: unsupported SASL mechanism %q", network.SASL.Mechanism)
}
}