block

package
v0.0.0-...-e8da0a6 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Throw

func Throw(ex Exception)

Throw raise panic with exception

Types

type Block

type Block struct {
	Try     func()
	Catch   func(error)
	Finally func()
}
Block {
	Try: func() {
		fmt.Println("Try..")
		Throw("stop it")
	},
	Catch: func(e Exception) {
		fmt.Printf("Caught %v\n", e)
	},
	Finally: func() {
		fmt.Println("Finally..")
	},
}.Do()

Block Try-Catch-Finally block struct

func (Block) Do

func (b Block) Do()

Do run block state

type Exception

type Exception interface{}

Exception pass exception to Catch

Jump to

Keyboard shortcuts

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