Categorygithub.com/EchoUtopia/zerror/v2
modulepackage
2.1.0
Repository: https://github.com/echoutopia/zerror.git
Documentation: pkg.go.dev

# README

ZError

Notice

v1 is deprecated, please use v2

import path : github.com/EchoUtopia/zerror/v2

example import path: github.com/EchoUtopia/zerror/examples/v2

中文文档

Terminology

  • Error Definition(zerror.Def): error definition to generate or wrap error

Features

  • Predefine errors
  • Make error code predefined and standard
  • Specified error definition Status Code for Http, Grpc and so on
  • Classify errors with groups
  • Some built-in error definitions, like zerror.NotFound, zerror.Forbidden and so on
  • List all error codes and corresponding infos(descriptions, status code, etc)
  • Extension for every error definition to do many cool things you want.

Examples:



func DoSomething()error {
    ***
    // return zerror.Internal.Wrap(errors.New(`***`))
    return zerror.BadRequest.New()
}

full examples

see in examples directory

Why is zerror made

I want errors to be clearly organized and reusable and classified in groups

I want hide errors from client and return code instead

I want to respond predefined code and log error in one line code

I want to respond with different Status Code for Grpc/Http for error generated/wrapped by zerror

so Zerror is here

# Functions

if not set, default 500.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author