try

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Catch

func Catch(f js.Func, args ...interface{}) (js.Value, error)

Catch is a function that takes a js.Func and any number of arguments.

If the js.Func throws/raises an error, it will return the error.

It does so by effectively shelling out to the following javascript:

(function(arg1, arg2, ...){
    try{
        return func(arg1, arg2, ...)
    }catch(e){
        return e
    }
})

The returned value is the value which the js.Func returns.

If an error occurs, the js.Value will be js.Null() and the error will be non-nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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