Skip to content

FrauElster/goerror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goerror

Its is a super-small super-light struct that I use in most of my projects to wrap errors. It is a little bit unorthodox, since it features some chaining methods, but I think it is very handy.

Each error has a unique ID, and a message. The ID is used to identify the error, e.g. with errors.Is(). The message is used to display a user message.

This originated from one of my web projects. Error.Message is thought as return value for the user, the actual error is stored in Error.Err. Therefore, Error.MarshalJSON() will return the message, and Error.Id, but not the actual error.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages