try: github.com/thestrukture/try Index | Files

package try

import "github.com/thestrukture/try"

Index

Package Files

try_funcs.go try_types.go

func Throw Uses

func Throw(e interface{})

Throw abstracts writing error check statements. Throw will invoke panic when the parameter passed does not equal nil.

type Error Uses

type Error func(e interface{})

Error abstracts passing code blocks to handle errors generated

type Task Uses

type Task func()

Task abstracts passing code blocks into the try/finally statement

type TryStatement Uses

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

TryStatement is the type returned on execution of package function Try.. This enables chaining functions that compose the try/catch/finally statement.

func Run Uses

func Run(t Task) TryStatement

Run initializes the try statement. The function passed is stored, to be ran later.

func (TryStatement) Catch Uses

func (t TryStatement) Catch(e Error) TryStatement

Catch stores the error handler code block to the Try Statement.

func (TryStatement) Finally Uses

func (t TryStatement) Finally(task Task)

Finally executes the statement and recovers from any panics.

Updated 2020-03-12. Refresh now. Tools for package owners.