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
|
|
|
|
|
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 —
|
|
|
|
|
2023-09-22 19:46:12 +00:00
|
|
|
With `erorr.Error`:
|
2024-07-04 14:53:50 +00:00
|
|
|
|
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
|
|
|
```
|
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`.**
|
|
|
|
|
2023-09-22 19:46:12 +00:00
|
|
|
And with `erorr.Errorf`:
|
2024-07-04 14:53:50 +00:00
|
|
|
|
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
|
|
|
```
|
2024-08-01 23:34:37 +00:00
|
|
|
|
|
|
|
## Import
|
|
|
|
|
|
|
|
To import package **erorr** use `import` code like the follownig:
|
|
|
|
```
|
|
|
|
import "github.com/reiver/go-erorr"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
To install package **erorr** do the following:
|
|
|
|
```
|
|
|
|
GOPROXY=direct go get https://github.com/reiver/go-erorr
|
|
|
|
```
|
|
|
|
|
|
|
|
## Author
|
|
|
|
|
|
|
|
Package **erorr** was written by [Charles Iliya Krempeaux](http://reiver.link)
|