2023-09-22 19:46:12 +00:00
|
|
|
# go-erorr
|
2021-11-19 23:41:30 +00:00
|
|
|
|
2023-09-22 19:47:05 +00:00
|
|
|
Package **erorr** implements tools to create and manipulate errors, for the Go programming language.
|
2023-09-22 19:46:12 +00:00
|
|
|
|
|
|
|
(This package used to be called "fck".)
|
2021-11-19 23:41:30 +00:00
|
|
|
|
|
|
|
## Documention
|
|
|
|
|
2023-09-22 19:46:12 +00:00
|
|
|
Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-erorr
|
2021-11-19 23:41:30 +00:00
|
|
|
|
2023-09-22 19:46:12 +00:00
|
|
|
[![GoDoc](https://godoc.org/sourcecode.social/reiver/go-erorr?status.svg)](https://godoc.org/sourcecode.social/reiver/go-erorr)
|
2021-11-19 23:41:30 +00:00
|
|
|
|
|
|
|
## Creating Errors
|
|
|
|
|
|
|
|
There are two ways to create errors —
|
|
|
|
|
2023-09-22 19:46:12 +00:00
|
|
|
With `erorr.Error`:
|
2021-11-19 23:41:30 +00:00
|
|
|
```
|
2023-09-22 19:46:12 +00:00
|
|
|
const err error = erorr.Error("internal-error")
|
2021-11-19 23:41:30 +00:00
|
|
|
```
|
2023-09-22 19:46:12 +00:00
|
|
|
And with `erorr.Errorf`:
|
2021-11-19 23:41:30 +00:00
|
|
|
```
|
2023-09-22 19:46:12 +00:00
|
|
|
var err error = erorr.Errorf("bad value for id %q", id)
|
2021-11-19 23:41:30 +00:00
|
|
|
```
|
|
|
|
|
2023-09-22 19:46:12 +00:00
|
|
|
**One thing to notice is that `erorr.Error` errors can be a Go `const`.**
|