Return error instead of Fatal log

This commit is contained in:
Till Faelligen 2022-07-18 14:10:06 +02:00
parent 6a3dd9e890
commit 1cb3cbbb6d
2 changed files with 4 additions and 6 deletions

View file

@ -25,7 +25,6 @@ import (
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/syncapi/storage/postgres/deltas"
"github.com/matrix-org/dendrite/syncapi/storage/shared"
"github.com/sirupsen/logrus"
)
// SyncServerDatasource represents a sync server datasource which manages
@ -44,10 +43,10 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions)
return nil, err
}
if _, err = d.db.Exec(outputRoomEventsSchema); err != nil {
logrus.Fatalf("unable to create table: %s", err)
return nil, err
}
if _, err = d.db.Exec(currentRoomStateSchema); err != nil {
logrus.Fatalf("unable to create table: %s", err)
return nil, err
}
accountData, err := NewPostgresAccountDataTable(d.db)
if err != nil {

View file

@ -23,7 +23,6 @@ import (
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/syncapi/storage/shared"
"github.com/matrix-org/dendrite/syncapi/storage/sqlite3/deltas"
"github.com/sirupsen/logrus"
)
// SyncServerDatasource represents a sync server datasource which manages
@ -54,10 +53,10 @@ func (d *SyncServerDatasource) prepare(dbProperties *config.DatabaseOptions) (er
return err
}
if _, err = d.db.Exec(outputRoomEventsSchema); err != nil {
logrus.Fatalf("unable to create table: %s", err)
return err
}
if _, err = d.db.Exec(currentRoomStateSchema); err != nil {
logrus.Fatalf("unable to create table: %s", err)
return err
}
accountData, err := NewSqliteAccountDataTable(d.db, &d.streamID)
if err != nil {