updated README.md file

master
Charles Iliya Krempeaux 2023-08-14 05:56:20 -07:00
parent 635fba49cf
commit 3bacef551e
1 changed files with 36 additions and 4 deletions

View File

@ -1,11 +1,14 @@
# go-errhttp # go-errhttp
Package **errhttp** provides types errors that make dealing with HTTP response errors easier, for the Go programming language. Package **errhttp** provides errors and types that make dealing with HTTP response errors easier, for the Go programming language.
## Example ## Example
Here is an example of wrapping an error:
```go ```go
import "github.com/reiver/go-errhttp" import "sourcecode.social/reiver/go-errhttp"
// ... // ...
@ -33,8 +36,37 @@ Package **errhttp** provides types errors that make dealing with HTTP response e
} }
``` ```
Here is an example of using one of the package global variable errors:
```go
import "sourcecode.social/reiver/go-errhttp"
// ...
return errhttp.ErrBadRequest
// ...
switch err.(type) {
case errhttp.BadRequest:
//@TODO
case errhttp.NotFound:
//@TODO
case errhttp.InternalServerError:
//@TODO
case errhttp.ClientError:
//@TODO
case errhttp.ServerError:
//@TODO
default:
//@TODO
}
```
## Documention ## Documention
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-errhttp Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-errhttp
[![GoDoc](https://godoc.org/github.com/reiver/go-errhttp?status.svg)](https://godoc.org/github.com/reiver/go-errhttp) [![GoDoc](https://godoc.org/sourcecode.social/reiver/go-errhttp?status.svg)](https://godoc.org/sourcecode.social/reiver/go-errhttp)