- Notifications
You must be signed in to change notification settings - Fork0
🪳 Lib written in Go, facilitates and improves the visibility of errors that occur in your project, for better bug debugging, we have a robust structure and following the standard error interface, we have message, file, line, stack trace, cause everything for your project.
License
GabrielHCataldo/go-errors
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The go-errors project came to clarify the return of errors, which are very common in Golang, thus facilitating thedebugging your projects.
Use go get.
go get github.com/GabrielHCataldo/go-errorsThen import the go-errors package into your own code.
import"github.com/GabrielHCataldo/go-errors/errors"
IMPORTANT: Always check the documentation in the structures and functions fields.For more details on the examples, visitAll examples link.
package mainimport ("github.com/GabrielHCataldo/go-errors/errors""github.com/GabrielHCataldo/go-logger/logger")funcmain() {err:=simple()logger.Info("simple err:",err)logger.Info("simple err msg:",errors.Details(err).GetMessage())logger.Info("simple err file:",errors.Details(err).GetFile())logger.Info("simple err line:",errors.Details(err).GetLine())logger.Info("simple err func:",errors.Details(err).GetFuncName())errors.Details(err).PrintCause()errors.Details(err).PrintStackTrace()}funcsimple()error {returnerrors.New("error by message with any value",2,true)}
Output:
[INFO 2024/01/26 10:16:38] _example/main.go:12: simple err: [CAUSE]: (_example/main.go:25) simple: error by message with any value 2 true [STACK]:goroutine 1 [running]:runtime/debug.Stack() /Users/gabrielcataldo/go/go1.21.3/src/runtime/debug/stack.go:24 +0x64github.com/GabrielHCataldo/go-errors/errors.New({0x1400039fd18?, 0x0?, 0x1400039fc38?}) /Users/gabrielcataldo/Innovfor/GabrielHCataldo/go-errors/errors/errors.go:31 +0xe0main.simple(...) /Users/gabrielcataldo/Innovfor/GabrielHCataldo/go-errors/_example/main.go:25main.main() /Users/gabrielcataldo/Innovfor/GabrielHCataldo/go-errors/_example/main.go:11 +0x88[INFO 2024/01/26 10:16:38] _example/main.go:12: simple err msg: error by message with any value 2 true[INFO 2024/01/26 10:16:38] _example/main.go:13: simple err file: _example/main.go[INFO 2024/01/26 10:16:38] _example/main.go:14: simple err line: 25[INFO 2024/01/26 10:16:38] _example/main.go:15: simple err func: simple[ERROR 2024/01/26 10:16:38] _example/main.go:16: (_example/main.go:25) simple: error by message with any value 2 true[ERROR 2024/01/26 10:16:38] _example/main.go:17: goroutine 1 [running]:Make a pull request, or if you find a bug, open itan Issues.
Distributed under MIT license, see the license file within the code for more details.
About
🪳 Lib written in Go, facilitates and improves the visibility of errors that occur in your project, for better bug debugging, we have a robust structure and following the standard error interface, we have message, file, line, stack trace, cause everything for your project.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
