errors

package
v0.23.0-rc1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package errors represents base tron error struct and parsing method.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Details added in v0.9.0

type Details struct {
	Code        string `json:"code,omitempty"`
	Field       string `json:"field,omitempty"`
	Description string `json:"description,omitempty"`
}

Details represents error details.

type Error

type Error struct {
	Message string     `json:"message,omitempty"`
	Details []*Details `json:"details,omitempty"`
	TraceID string     `json:"trace_id"`
	// contains filtered or unexported fields
}

Error represents base http error struct.

func ParseError

func ParseError(ctx context.Context, err error) *Error

ParseError parse error to Error struct. Support lissteron/simplerr and ozzo-validation packages.

func (*Error) Error added in v0.8.0

func (e *Error) Error() string

Error returns error string.

func (*Error) GRPCStatus added in v0.8.0

func (e *Error) GRPCStatus() *status.Status

GRPCStatus build status.Status from current error.

func (*Error) HTTPStatus added in v0.8.0

func (e *Error) HTTPStatus() int

HTTPStatus return http status for error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL