JSON Errors for Go

PkgGoDev Go (build) Go Report Card CodeQL

jerr provides a simple error handling for your rest applications.


  • Compatible with built-in error interface
  • Error wrapping
  • JSON escaping


Getting Started

go get github.com/erdaltsksn/jerr
touch main.go


package main

import (


func main() {
    err := someFunc()
    if err != nil {
        wrapped := jerr.Wrap(err, "Message about error")

func someFunc() error {
    return jerr.New("nope")
go run main.go


{"message":"Message about error","details":{"message":"nope"}}


go get github.com/erdaltsksn/jerr

Updating / Upgrading

go get -u github.com/erdaltsksn/jerr


// Simple error.
errSimple := jerr.New("Error Message")

// An error that wraps another error.
err := SomeFunc()
if err != nil {
    fmt.Print(jerr.Wrap(err, "Message about error"))

Check out examples directory for more.


If you want to contribute to this project and make it better, your help is very welcome. See CONTRIBUTING for more information.

Security Policy

If you discover a security vulnerability within this project, please follow our Security Policy Guide.

Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.


In no event shall we be liable to you or any third parties for any special, punitive, incidental, indirect or consequential damages of any kind, or any damages whatsoever, including, without limitation, those resulting from loss of use, data or profits, and on any theory of liability, arising out of or in connection with the use of this software.


JSON errors for Go Rest APIs.

Jerr Info

⭐ Stars 13
🔗 Homepage github.com
🔗 Source Code github.com
🕒 Last Update 7 months ago
🕒 Created 2 years ago
🐞 Open Issues 0
➗ Star-Issue Ratio Infinity
😎 Author erdaltsksn