error_handler is an attempt to make debugging easier for programmers and non-programming techies. You get Python or Laravel-like error reporting, with code tracing and easy-to-make-sense-of error report phrases.
In your project import the public package:
go get github.com/joshuaetim/error_handler/v2package main
import (
"fmt"
"github.com/joshuaetim/error_handler/v2"
)
func main() {
handler := error_handler.NewErrorHandler(&error_handler.Config{
PreferredColor: error_handler.ColorRed,
})
defer handler.HandleError()
num := 0
main := 4 / num
fmt.Println(main)
}Result:
there was an error:
File: /go/src/calc/divisor.go
Function: main.main
Line: 13
Message: You cannot divide by zero
====================================================================================================
8
9 func main() {
10 defer error_handler.HandleError()
11
12 num := 0
13 main := 4 / num
~~~~~~~~~~~~~~~
14 fmt.Println(main)
15 }LinkedIn: https://www.linkedin.com/in/joshuaetim/
Twitter: https://twitter.com/theJoshuaEtim