gotry

package module
v0.0.0-...-b26551e Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2019 License: MIT Imports: 5 Imported by: 0

README

gotry

golang try catch实现

example


gotry.Try(func(assert *gotry.Assert) {
		assert.Assert(true, "sss%s", "dd")
	}).Catch(func(err error) {
		fmt.Println(err.Error())
	})

	gotry.Try(func(assert *gotry.Assert) {
		assert.AssertErr(fmt.Errorf("ddd%d", 222), "sss%s", "dd")
	}).Catch(func(err error) {
		fmt.Println(err.Error())
	})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Try

func Try(fn func(assert *Assert)) *_try

Types

type Assert

type Assert struct {
}

func (*Assert) Assert

func (t *Assert) Assert(b bool, format string, args ...interface{})

func (*Assert) AssertErr

func (t *Assert) AssertErr(err error, format string, args ...interface{})

func (*Assert) MustNotError

func (t *Assert) MustNotError(err error)

func (*Assert) P

func (t *Assert) P(format string, args ...interface{})

func (*Assert) Println

func (t *Assert) Println(args ...interface{})

Jump to

Keyboard shortcuts

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