Discover Packages
github.com/bytom/vapor
net
http
httperror
package
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Jul 18, 2019
License: AGPL-3.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 2
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package httperror defines the format for HTTP error responses
from Chain services.
Formatter defines rules for mapping errors to the Chain error
response format.
Format builds an error Response body describing err by consulting
the f.Errors lookup table. If no entry is found, it returns f.Default.
Write writes a json encoded Response to the ResponseWriter.
It uses the status code associated with the error.
Write may be used as an ErrorWriter in the httpjson package.
type Info struct {
HTTPStatus int `json:"-"`
ChainCode string `json:"code"`
Message string `json:"msg"`
}
Info contains a set of error codes to send to the user.
type Response struct {
Info
Status string `json:"status,omitempty"`
Detail string `json:"detail,omitempty"`
Data map[string ]interface{} `json:"data,omitempty"`
Temporary bool `json:"temporary"`
}
Response defines the error response for a Chain error.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.