fix (events): convert multierror to stdlib error (#3743)

* fix (events): convert multierror to stdlib error

multierror errors will be converted to a stdlib error (because
multierror doesn't support json marshaling).

* refact (errors): convert from multierror to stdlib errors.Join(...)

* refact: convert from pkg/errors to stdlib error wrapping
This commit is contained in:
Jim authored and GitHub committed 2023-09-17 19:35:43 -04:00
1 parent 98f8383a2b
commit 0d19892e03
28 files changed
+142 -152

No files matched your search

+6 -6
View File
@@ -6,6 +6,7 @@ package base
import (
"context"
"crypto/ed25519"
"errors"
"fmt"
"net"
"net/url"
@@ -24,7 +25,6 @@ import (
"github.com/hashicorp/boundary/internal/types/scope"
"github.com/hashicorp/boundary/testing/dbtest"
capoidc "github.com/hashicorp/cap/oidc"
"github.com/hashicorp/go-multierror"
"github.com/jimlambrt/gldap"
"github.com/jimlambrt/gldap/testdirectory"
)
@@ -75,7 +75,7 @@ func (b *Server) CreateDevDatabase(ctx context.Context, opt ...Option) error {
if err != nil {
err = fmt.Errorf("unable to initialize dev database with dialect %s: %w", dialect, err)
if c != nil {
err = multierror.Append(err, c())
err = errors.Join(err, c())
}
return err
}
@@ -87,7 +87,7 @@ func (b *Server) CreateDevDatabase(ctx context.Context, opt ...Option) error {
if _, err := schema.MigrateStore(ctx, schema.Dialect(dialect), b.DatabaseUrl); err != nil {
err = fmt.Errorf("error initializing store: %w", err)
if c != nil {
err = multierror.Append(err, c())
err = errors.Join(err, c())
}
return err
}
@@ -102,21 +102,21 @@ func (b *Server) CreateDevDatabase(ctx context.Context, opt ...Option) error {
if err := b.OpenAndSetServerDatabase(ctx, dialect); err != nil {
if c != nil {
err = multierror.Append(err, c())
err = errors.Join(err, c())
}
return err
}
if err := b.CreateGlobalKmsKeys(ctx); err != nil {
if c != nil {
err = multierror.Append(err, c())
err = errors.Join(err, c())
}
return err
}
if _, err := b.CreateInitialLoginRole(ctx); err != nil {
if c != nil {
err = multierror.Append(err, c())
err = errors.Join(err, c())
}
return err
}