Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ResolutionEmpty is equivalent to an empty string. ResolutionEmpty = "" // ResolutionUnknown indicates that there is no known // resolution for the fault. ResolutionUnknown = "no known resolution" // ResolutionNone indicates that the fault cannot be // resolved. ResolutionNone = "none" )
View Source
const ( UnknownDomainStr = "unknown" UnknownDescriptionStr = "unknown fault" )
Variables ¶
View Source
var ( // UnknownFault represents an unknown fault. UnknownFault = &Fault{ Code: code.Unknown, Resolution: ResolutionUnknown, } )
Functions ¶
func HasResolution ¶
HasResolution indicates whether or not the error has a resolution defined.
func ShowResolutionFor ¶
ShowResolutionFor attempts to return the resolution string for the given error. If the error is not a fault or does not have a resolution set, then the string value of ResolutionUnknown is returned.
Types ¶
type Fault ¶
type Fault struct { // Domain indicates the group or family for the fault // (e.g. storage, network, etc.) It is used as a prefix // when displaying the fault. Domain string // Code is the unique numeric identifier for known faults. Code code.Code // Description is the main description of the fault. It usually // includes the reason for the fault, and therefore it is not // necessary to display both Description and Reason. Description string // Reason is a short (single sentence) description of the // fault, to be displayed where brevity is preferred. Reason string // Resolution is used to suggest possible solutions for // the fault, if appropriate. Resolution string }
Fault represents a well-known error specific to a domain, along with an optional potential resolution for the error.
It implements the error interface and can be used interchangeably with regular "dumb" errors.
Click to show internal directories.
Click to hide internal directories.