By design, Go doesn't offer any mechanism for Exception handling. But Programmers from different backgrounds like Java, C++, Php can be sceptical abou

GitHub - rbrahul/exception: A simple utility package for exception handling with try-catch in Golang

submited by
Style Pass
2022-05-18 03:00:08

By design, Go doesn't offer any mechanism for Exception handling. But Programmers from different backgrounds like Java, C++, Php can be sceptical about the decision. Exception handling with Try Catch Finally is well adapted in all the modern languages. To ease the pain, this library offers utility functions for Exception Handling, which will help programmers to write Go code with Try-Catch-Finally approach.

Now you have to initialize and throw your exception via e.New constructor. You can pass a proper error message as optional argument.

Leave a Comment