Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oxequa/grace

Handle Go recover, panic, and errors in a graceful way. Multiple errors support, basic filters and custom handlers.
https://github.com/oxequa/grace

error-handling go go-library go-tools golang golang-package golang-wrapper

Last synced: about 1 month ago
JSON representation

Handle Go recover, panic, and errors in a graceful way. Multiple errors support, basic filters and custom handlers.

Awesome Lists containing this project

README

        





Build status
GoReport
GoDoc
License
Gitter




Handle recover, panic and errors in a graceful way



## Quickstart

```
go get github.com/oxequa/grace
```

The following is a simple example that handles a panic and returns the error without the program crash.

```go
package main

import (
"fmt"
"github.com/oxequa/grace"
)

func example() (e error){
defer grace.Recover(&e) // save recover error and stack trace to e
numbers := []int{1, 2}
fmt.Println(numbers[3]) // panic out of index
return
}

func main() {
err := example() // no panic occur
fmt.Println(err)
fmt.Println("End")
}
```

## Documentation

You can read the full documentation of Grace [here](https://grace.oxequa.com).

## Contributing

Please read our guideline [here](CONTRIBUTING.md).

## License

Grace is licensed under the [GNU GENERAL PUBLIC LICENSE V3](LICENSE).