Documentation ¶
Overview ¶
Package errors provides error types returned in CF SSL.
1. Type Error is intended for errors produced by CF SSL packages. It formats to a json object that consists of an error message and a 4-digit code for error reasoning.
Example: {"code":1002, "message": "Failed to decode certificate"}
The index of codes are listed below:
1XXX: CertificateError 1000: Unknown 1001: ReadFailed 1002: DecodeFailed 1003: ParseFailed 1100: SelfSigned 12XX: VerifyFailed 121X: CertificateInvalid 1210: NotAuthorizedToSign 1211: Expired 1212: CANotAuthorizedForThisName 1213: TooManyIntermediates 1214: IncompatibleUsage 1220: UnknownAuthority 2XXX: PrivatekeyError 2000: Unknown 2001: ReadFailed 2002: DecodeFailed 2003: ParseFailed 2100: Encrypted 2200: NotRSA 2300: KeyMismatch 3XXX: IntermediatesError 4XXX: RootError 5XXX: PolicyError 5100: NoKeyUsages 5200: InvalidPolicy 5300: InvalidRequest 6XXX: DialError
2. Type HttpError is intended for CF SSL API to consume. It contains a HTTP status code that will be read and returned by the API server.
Index ¶
Constants ¶
const ( BundleExpiringBit int = 1 << iota // 0x01 BundleNotUbiquitousBit // 0x02 )
Warning code for a success
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category int
The error category as the most significant digit of the error code
type Error ¶
Error is the error type usually returned by functions in CF SSL package. It contains a 4-digit error code where the most significant digit describes the category where the error occurred and the rest 3 digits describe the specific error reason.
type HttpError ¶
type HttpError struct { StatusCode int // contains filtered or unexported fields }
HttpError is an augmented error with a HTTP status code.
func NewBadRequest ¶
NewBadRequest creates a HttpError with the given error and error code 400.
func NewBadRequestMissingParameter ¶
NewBadRequestMissingParameter returns a 400 HttpError as a required parameter is missing in the HTTP request.
func NewBadRequestString ¶
NewBadRequestString returns a HttpError with the supplied message and error code 400.
func NewBadRequestUnwantedParameter ¶
NewBadRequestUnwantedParameter returns a 400 HttpError as a unnecessary parameter is present in the HTTP request.
func NewMethodNotAllowed ¶
type Reason ¶
type Reason int
The error reason as the last 3 digits of the error code.
Parsing errors
const ( // Code 11XX SelfSigned Reason = 100 * (iota + 1) // Code 12XX // The least two significant digits of 12XX is determined as the actual x509 error is examined. VerifyFailed // Returned on bad certificate request BadRequest )
Certificate non-parsing errors, must be specified along with CertificateError
const ( Encrypted Reason = 100 * (iota + 1) //21XX NotRSAOrECC //22XX KeyMismatch //23XX GenerationFailed //24XX )
Private key non-parsing errors, must be specified with PrivateKeyError