rae

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

README

RAE

restful api error

RESTful API error manage

Features

  • YAML define error
    app: app_name
    version: 1.0
    errors:
    - key: database-error
      code: 1001
      msg: database error
      desc: database error check ip
    - key: your-key
      code: 1002
      msg: your massage
      desc: your error description
    
  • ctrip apollo support for manage errors yml file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorType

func ErrorType(raeType RestAPIError)

ErrorType set error type

func LoadFromFile

func LoadFromFile(filename string) error

LoadFromFile load errors from yaml file

Types

type DefaultRestAPIError

type DefaultRestAPIError struct {
	ErrCode string `json:"err_code,omitempty"`
	ErrMsg  string `json:"err_msg,omitempty"`
	ErrDesc string `json:"err_desc,omitempty"`
}

DefaultRestAPIError default RestAPIError impl

func (DefaultRestAPIError) Code

func (ie DefaultRestAPIError) Code() string

Code get error code for rae

func (DefaultRestAPIError) Desc

func (ie DefaultRestAPIError) Desc() string

Desc get description for rae

func (DefaultRestAPIError) Msg

func (ie DefaultRestAPIError) Msg() string

Msg get msg for rae

func (*DefaultRestAPIError) Set

func (ie *DefaultRestAPIError) Set(code, msg, desc string)

Set set error value for rae

type RestAPIError

type RestAPIError interface {
	Code() string
	Msg() string
	Desc() string
	Set(code, msg, desc string)
}

RestAPIError restful api error

func Error

func Error(key string) (RestAPIError, error)

Error get rest api error by key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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