Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make yomo_wanted_target function optional in wasm #980

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions cli/serverless/wasm/wazero.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,13 @@
}

wantedTargetFunc := module.ExportedFunction(WasmFuncWantedTarget)
if wantedTargetFunc == nil {
return fmt.Errorf("%s function not found", WasmFuncWantedTarget)
}
if _, err := wantedTargetFunc.Call(r.ctx); err != nil {
if exitErr, ok := err.(*sys.ExitError); ok && exitErr.ExitCode() != 0 {
return fmt.Errorf("%s.Call: %v", WasmFuncWantedTarget, err)
} else if !ok {
return fmt.Errorf("%s.Call: %v", WasmFuncWantedTarget, err)
if wantedTargetFunc != nil {
if _, err := wantedTargetFunc.Call(r.ctx); err != nil {
if exitErr, ok := err.(*sys.ExitError); ok && exitErr.ExitCode() != 0 {
return fmt.Errorf("%s.Call: %v", WasmFuncWantedTarget, err)
} else if !ok {
return fmt.Errorf("%s.Call: %v", WasmFuncWantedTarget, err)
}

Check warning on line 137 in cli/serverless/wasm/wazero.go

View check run for this annotation

Codecov / codecov/patch

cli/serverless/wasm/wazero.go#L131-L137

Added lines #L131 - L137 were not covered by tests
}
}

Expand Down
Loading