Documentation
¶
Overview ¶
Package errors implements functions to manipulate KSI errors.
Index ¶
- Constants
- type ErrorCode
- type KsiError
- func (e *KsiError) AppendMessage(msg string) *KsiError
- func (e *KsiError) Code() ErrorCode
- func (e *KsiError) Error() string
- func (e *KsiError) ExtCode() int
- func (e *KsiError) ExtError() error
- func (e *KsiError) Message() []string
- func (e *KsiError) SetExtError(err error) *KsiError
- func (e *KsiError) SetExtErrorCode(c int) *KsiError
- func (e *KsiError) Stack() string
Constants ¶
const ( // KsiNoError represent a successful result. KsiNoError = ErrorCode(0) // KsiInvalidArgumentError is in case of invalid function input argument (eg. nil pointer). KsiInvalidArgumentError = ErrorCode(0x100) // KsiInvalidFormatError the provided value is invalid (eg. out of range). KsiInvalidFormatError = ErrorCode(0x101) // KsiBufferOverflow is set in case of buffer or value overflow. KsiBufferOverflow = ErrorCode(0x104) // KsiInvalidPkiSignature is set in case of invalid PKI signature. KsiInvalidPkiSignature = ErrorCode(0x108) // KsiPkiCertificateNotTrusted is set in case the PKI signature is not trusted by the API. KsiPkiCertificateNotTrusted = ErrorCode(0x109) // KsiInvalidStateError is set in case the objects used are in an invalid state (eg. missing mandatory member value). KsiInvalidStateError = ErrorCode(0x10a) // KsiUnknownHashAlgorithm is set in case the hash algorithm ID is invalid or unknown to the API. KsiUnknownHashAlgorithm = ErrorCode(0x10b) // KsiNetworkError is set in cse a network error occurred. KsiNetworkError = ErrorCode(0x200) // KsiHttpError is set in case an HTTP error has been received. KsiHttpError = ErrorCode(0x201) // KsiIoError is set in case IO error occurred. KsiIoError = ErrorCode(0x202) // KsiExtendNoSuitablePublication is set in case no suitable publication is available to extend the signature to. KsiExtendNoSuitablePublication = ErrorCode(0x208) // KsiVerificationFailure is a common signature verification failure. KsiVerificationFailure = ErrorCode(0x20a) // KsiHmacMismatch is set in case HMAC mismatch occurred. KsiHmacMismatch = ErrorCode(0x20e) // KsiPublicationsFileNotSignedWithPki is set in case the publications file is not signed. KsiPublicationsFileNotSignedWithPki = ErrorCode(0x20c) // KsiCryptoFailure is set in case cryptographic operation could not be performed. Likely causes are unsupported // cryptographic algorithms, invalid keys and lack of resources. KsiCryptoFailure = ErrorCode(0x20d) // KsiRequestIdMismatch the request ID in response does not match with request ID in request. KsiRequestIdMismatch = ErrorCode(0x210) // KsiHmacAlgorithmMismatch is set in case HMAC algorithm mismatch occurred. KsiHmacAlgorithmMismatch = ErrorCode(0x211) // KsiIncompatibleHashChain is set in case of incompatibility of calendar hash chains. KsiIncompatibleHashChain = ErrorCode(0x213) // KsiExternalError is set in case external error from 3rd party API (eg std library) is returned and wrapped automatically inside KsiError. KsiExternalError = ErrorCode(0x214) // KsiServiceInvalidRequest is set in case a request had invalid format (could not be parsed as a PDU consisting of // header, payload, and MAC elements). KsiServiceInvalidRequest = ErrorCode(0x400) // KsiServiceAuthenticationFailure is set in case a request could not be authenticated (missing or unknown login // identifier, MAC check failure, etc). KsiServiceAuthenticationFailure = ErrorCode(0x401) // KsiServiceInvalidPayload is set in case a request contained invalid payload (unknown payload type, missing // mandatory elements, unknown critical elements, etc). KsiServiceInvalidPayload = ErrorCode(0x402) // KsiServiceInternalError is set in case server encountered an unspecified internal error. KsiServiceInternalError = ErrorCode(0x403) // KsiServiceUpstreamError is set in case server encountered unspecified critical errors connecting to upstream // servers. KsiServiceUpstreamError = ErrorCode(0x404) // KsiServiceUpstreamTimeout is set in case there is no response from upstream server. KsiServiceUpstreamTimeout = ErrorCode(0x405) // KsiServiceUnknownError is set in case in unknown error has been received from the server. KsiServiceUnknownError = ErrorCode(0x406) // KsiServiceAggrRequestTooLarge is set in case the request indicated client-side aggregation tree larger than // allowed for the client (retrying would not succeed either). KsiServiceAggrRequestTooLarge = ErrorCode(0x421) // KsiServiceAggrRequestOverQuota is set in case the request combined with other requests from the same client in // the same round would create an aggregation sub-tree larger than allowed for the client (retrying in a later round // could succeed). KsiServiceAggrRequestOverQuota = ErrorCode(0x422) // KsiServiceAggrTooManyRequests is set in case too many requests from the client in the same round (retrying in a // later round could succeed) KsiServiceAggrTooManyRequests = ErrorCode(0x423) // KsiServiceAggrInputTooLong is set in case input hash value in the client request is longer than the server allows. KsiServiceAggrInputTooLong = ErrorCode(0x424) // KsiServiceExtenderInvalidTimeRange is set in case the request asked for a hash chain going backwards in time. KsiServiceExtenderInvalidTimeRange = ErrorCode(0x441) // KsiServiceExtenderDatabaseMissing is set in case the server misses the internal database needed to service the // request (most likely it has not been initialized yet). KsiServiceExtenderDatabaseMissing = ErrorCode(0x442) // KsiServiceExtenderDatabaseCorrupt is set in case the server's internal database is in an inconsistent state. KsiServiceExtenderDatabaseCorrupt = ErrorCode(0x443) // KsiServiceExtenderRequestTimeTooOld is set in case the request asked for hash values older than the oldest round // in the server's database. KsiServiceExtenderRequestTimeTooOld = ErrorCode(0x444) // KsiServiceExtenderRequestTimeTooNew is set in case the request asked for hash values newer than the newest round // in the server's database. KsiServiceExtenderRequestTimeTooNew = ErrorCode(0x445) // KsiServiceExtenderRequestTimeInFuture is set in case the request asked for hash values newer than the current // real time. KsiServiceExtenderRequestTimeInFuture = ErrorCode(0x446) // KsiNotImplemented indicates an invalid API state. KsiNotImplemented = ErrorCode(0xffff) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KsiError ¶
type KsiError struct {
// contains filtered or unexported fields
}
KsiError ...
func KsiErr ¶
KsiErr wraps the provided error into KsiError, if the input is not KsiError. By default the error code is set to KsiExternalError. In case the 'err' parameter is of type KsiError, the original error is returned without any modification.
Optionally an error code can be provided, which will be applied in case of external error. Note, despite the fact that 'code' parameter is a variadic value, only one error code should be provided.
func (*KsiError) AppendMessage ¶
AppendMessage allows to add an additional descriptive message to the error. Returns an updated reference of the receiver KsiError.
func (*KsiError) SetExtError ¶
SetExtError allows to set an additional low-level error. Returns an updated reference of the receiver KsiError.
func (*KsiError) SetExtErrorCode ¶
SetExtErrorCode allows to set an additional low-level error code. Returns an updated reference of the receiver KsiError.