https://github.com/aletheia7/errors
errors augments and error with a file and line number
https://github.com/aletheia7/errors
Last synced: 5 months ago
JSON representation
errors augments and error with a file and line number
- Host: GitHub
- URL: https://github.com/aletheia7/errors
- Owner: aletheia7
- License: bsd-2-clause
- Created: 2017-10-29T20:53:15.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T21:28:20.000Z (almost 8 years ago)
- Last Synced: 2025-02-16T19:42:17.452Z (8 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://godoc.org/github.com/aletheia7/errors)
#### Documentation
errors augments a golang error with a file and line number of where the error
was made.#### Example
```go
package mainimport (
"fmt"
"github.com/aletheia7/errors"
"log"
)func main() {
log.SetFlags(0)
err := fmt.Errorf("basic golang error")
err1 := errors.Wrap(err)
log.Println("err1:", err1)
log.Println("remove file/line from err1:", errors.Cause(err1))
err2 := errors.New("a better error")
log.Println("err2:", err2)
err3 := errors.Errorf("error number %v", 101)
log.Println("err3:", err3)
}
```
#### Output
```
err1: basic golang error t/t.go:12
remove file/line from err1: basic golang error
err2: a better error t/t.go:15
err3: error number 101 t/t.go:17
```#### License
Use of this source code is governed by a BSD-2-Clause license that can be
found in the LICENSE file.[](https://opensource.org/)