Help us shape the future of Go! Take the 2026 Go Developer Survey

block

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT 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