Discover Packages
github.com/btccom/bytom
net
http
httperror
package
Version:
v1.0.2
Opens a new window with list of versions in this module.
Published: May 14, 2018
License: AGPL-3.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
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:"message"`
}
Info contains a set of error codes to send to the user.
type Response struct {
Info
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.