Skip to content

Commit 93a9d01

Browse files
committed
chore: wrap errors
1 parent 4fbae32 commit 93a9d01

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/dynamodb/dynamodb.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dynamodb
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67

78
"github.com/testcontainers/testcontainers-go"
@@ -55,18 +56,20 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
5556

5657
// ConnectionString returns DynamoDB local endpoint host and port in <host>:<port> format
5758
func (c *DynamoDBContainer) ConnectionString(ctx context.Context) (string, error) {
59+
var errs []error
60+
5861
mappedPort, err := c.MappedPort(ctx, port)
5962
if err != nil {
60-
return "", err
63+
errs = append(errs, fmt.Errorf("mapped port: %w", err))
6164
}
6265

6366
hostIP, err := c.Host(ctx)
6467
if err != nil {
65-
return "", err
68+
errs = append(errs, fmt.Errorf("host: %w", err))
6669
}
6770

6871
uri := fmt.Sprintf("%s:%s", hostIP, mappedPort.Port())
69-
return uri, nil
72+
return uri, errors.Join(errs...)
7073
}
7174

7275
// WithSharedDB allows container reuse between successive runs. Data will be persisted

0 commit comments

Comments
 (0)