Popularity
1.2
Growing
Activity
0.0
Stable
13
1
0

Description

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

Programming language: Go
License: MIT License
Tags: Go Tools     Go     Dynamic     Golang     Golang Examples    

try alternatives and similar packages

Based on the "Go Tools" category.
Alternatively, view try alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of try or a related project?

Add another 'Go Tools' Package

README

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")
    })
}