sys

package
v0.0.0-...-29e2939 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package sys includes constants and types used by both public and internal APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExitError

type ExitError struct {
	// contains filtered or unexported fields
}

ExitError is returned to a caller of api.Function still running when api.Module CloseWithExitCode was invoked. ExitCode zero value means success, while any other value is an error.

Here's an example of how to get the exit code:

main := module.ExportedFunction("main")
if err := main(nil); err != nil {
	if exitErr, ok := err.(*wazero.ExitError); ok {
		// If your main function expects to exit, this could be ok if Code == 0
	}
--snip--

Note: While possible the reason of this was "proc_exit" from "wasi_snapshot_preview1", it could be from other host functions, for example an AssemblyScript's abort handler, or any arbitrary caller of CloseWithExitCode. See https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#proc_exit See https://www.assemblyscript.org/concepts.html#special-imports

func NewExitError

func NewExitError(moduleName string, exitCode uint32) *ExitError

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) ExitCode

func (e *ExitError) ExitCode() uint32

ExitCode returns zero on success, and an arbitrary value otherwise.

func (*ExitError) ModuleName

func (e *ExitError) ModuleName() string

ModuleName is the api.Module that was closed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL