mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 11:19:39 -06:00
Catch bucket not found error
Co-authored-by: Jörn Dreyer <jfd@butonic.de> Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
committed by
Ralf Haferkamp
parent
006051322f
commit
bcafd97e31
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/metrics"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/server/debug"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/server/http"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -61,7 +62,16 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
kv, err := js.KeyValue(cfg.Store.Database)
|
||||
if err != nil {
|
||||
return err
|
||||
if !errors.Is(err, nats.ErrBucketNotFound) {
|
||||
return errors.Wrapf(err, "Failed to get bucket (%s)", cfg.Store.Database)
|
||||
}
|
||||
|
||||
kv, err = js.CreateKeyValue(&nats.KeyValueConfig{
|
||||
Bucket: cfg.Store.Database,
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to create bucket (%s)", cfg.Store.Database)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user