Skip to content

Commit

Permalink
chore(runtime): add some wrapped context to errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeMac committed Jul 8, 2023
1 parent ec5f9a5 commit db33029
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit db33029

Please sign in to comment.