Skip to content

A go package that offers a try/catch statement block.

License

Notifications You must be signed in to change notification settings

thestrukture/try

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

try

A go package that offers a try/catch statement block.

Documentation

Here is a sample program making use of the try package. In this sample, variables in scope are accessed to demonstrate how this package interacts with your program.

package main

import (
	"github.com/thestrukture/try"
	"fmt"
	"errors"
)


func main(){

	count := 0

	try.Run(func(){
		count++
		count++

		// Will perform an error check, panic will
		// not be invoked if the interface passed is nil.
		try.Throw(errors.New("Crashed!"))

		fmt.Println(count);
	}).Catch(func(e interface{}){

		fmt.Println("Error : ", e)

	}).Finally(func(){
		fmt.Println("Done")
	})
}

About

A go package that offers a try/catch statement block.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages