go-erorr/README.md

32 lines
750 B
Markdown
Raw Normal View History

# go-erorr
2021-11-19 23:41:30 +00:00
Package **erorr** implements tools to create and manipulate errors, for the Go programming language.
(This package used to be called "fck".)
2021-11-19 23:41:30 +00:00
## Documention
2024-07-04 14:43:40 +00:00
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-erorr
2021-11-19 23:41:30 +00:00
2024-07-04 14:43:40 +00:00
[![GoDoc](https://godoc.org/github.com/reiver/go-erorr?status.svg)](https://godoc.org/github.com/reiver/go-erorr)
2021-11-19 23:41:30 +00:00
## Creating Errors
There are two ways to create errors —
With `erorr.Error`:
2024-07-04 14:53:50 +00:00
2021-11-19 23:41:30 +00:00
```
const err error = erorr.Error("internal-error")
2021-11-19 23:41:30 +00:00
```
2024-07-04 14:53:50 +00:00
**NOTICE THAT THAT ERROR IS A `const` RATHER THAN A `var`.**
**Errors creating using `erorr.Error` can be a Go `const`.**
And with `erorr.Errorf`:
2024-07-04 14:53:50 +00:00
2021-11-19 23:41:30 +00:00
```
var err error = erorr.Errorf("bad value for id %q", id)
2021-11-19 23:41:30 +00:00
```