try to improve error message if the user forgot to initialize the provider

See #138
This commit is contained in:
Nicola Murino 2020-07-09 20:01:37 +02:00
parent 95fe26f3e3
commit 8fddb742df

View file

@ -774,6 +774,9 @@ func sqlCommonGetDatabaseVersion(dbHandle *sql.DB) (schemaVersion, error) {
stmt, err := dbHandle.PrepareContext(ctx, q)
if err != nil {
providerLog(logger.LevelWarn, "error preparing database query %#v: %v", q, err)
if strings.Contains(err.Error(), sqlTableSchemaVersion) {
logger.WarnToConsole("database query error, did you forgot to run the \"initprovider\" command?")
}
return result, err
}
defer stmt.Close()