From db330290d0beb01f1263e27b809a5fae41a215d8 Mon Sep 17 00:00:00 2001 From: George MacRorie Date: Sat, 8 Jul 2023 12:27:59 +0100 Subject: [PATCH] chore(runtime): add some wrapped context to errors --- internal/runtime/runtime.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/runtime/runtime.go b/internal/runtime/runtime.go index 8e2459d..294ad0c 100644 --- a/internal/runtime/runtime.go +++ b/internal/runtime/runtime.go @@ -32,16 +32,16 @@ func NewFactory(ctx context.Context, path string) (_ *Factory, err error) { factory.wasm, err = os.ReadFile(path) if err != nil { - return nil, err + return nil, fmt.Errorf("opening file: %w", err) } buf := &bytes.Buffer{} if err := factory.invoke(ctx, buf, []string{"type"}); err != nil { - return nil, err + return nil, fmt.Errorf("getting type: %w", err) } if err := json.NewDecoder(buf).Decode(&factory.typ); err != nil { - return nil, err + return nil, fmt.Errorf("decoding type: %w", err) } factory.logger = slog.With(