Discover Packages
github.com/bytom/bytom
net
http
httperror
package
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Sep 29, 2017
License: AGPL-3.0
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 8
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.
Log writes a structured log entry to the chain/log logger with
information about the error and the HTTP response.
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.