Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - ddymko/go-jsonerror: Small package which wraps error responses to follow jsonapi.org

Small package which wraps error responses to follow jsonapi.org - ddymko/go-jsonerror

Visit SiteGitHub - ddymko/go-jsonerror: Small package which wraps error responses to follow jsonapi.org

GitHub - ddymko/go-jsonerror: Small package which wraps error responses to follow jsonapi.org

Small package which wraps error responses to follow jsonapi.org - ddymko/go-jsonerror

Powered by 0x5a.live ๐Ÿ’—

Go-JsonError

Go Report Card Build Status Coveragestatus GoDoc Mentioned in Awesome Go

Go-JsonError is meant to allow us to easily create json response errors that follow the JsonApi spec.

Json API Spec

Usuage

In order to use jsonError you will need to initliaze the ErrorJson struct. Then when you would like to add an error you must pass in a ErrorComp struct to the AddError().

This follows the jsonapi spec where the error response must return an array.

Here is a basic example

	var err ErrorJSON

	errorComposition := ErrorComp{
		Detail: "this is a error message",
		Code:   "This is the code",
		Source: Source{
			Pointer: "/unit/tests",
		},
		Title:  "Title Test",
		Status: 200,
	}

	err.AddError(errorComposition)

	err.Error()
	err.ErrorByte()

Running the tests

This package is just using the standard test packge included with go. You can run the test cases with

go test ./...

Contributing

Please feel free to submit any pull requests.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • David Dymko

License

This project is licensed under the MIT License - see the LICENSE.md file for details

GoLang Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.