| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cometa.Error.Code
Description
Named cardano-c status codes, including success. Unknown numeric codes are preserved exactly for logging and interchange. A code can be named even when this package does not expose operations from the corresponding domain.
import qualified Cometa.Error.Code as Code main :: IO () main = print (Code.fromNumber (Code.toNumber Code.InvalidArgument) == Code.InvalidArgument)
Synopsis
- data ErrorCode
- = Success
- | GenericFailure
- | InsufficientBufferSize
- | NullPointer
- | MemoryAllocationFailed
- | OutOfBoundsMemoryRead
- | OutOfBoundsMemoryWrite
- | InvalidArgument
- | InvalidUrl
- | ElementNotFound
- | EncodingFailure
- | DecodingFailure
- | ChecksumMismatch
- | InvalidJson
- | IntegerOverflow
- | IntegerUnderflow
- | ConversionFailed
- | IndexOutOfBounds
- | InvalidCertificateType
- | NotImplemented
- | InvalidPassphrase
- | IllegalState
- | DuplicateKey
- | JsonTypeMismatch
- | LossOfPrecision
- | InvalidMagic
- | InvalidChecksum
- | InvalidBlake2bHashSize
- | InvalidEd25519SignatureSize
- | InvalidEd25519PublicKeySize
- | InvalidEd25519PrivateKeySize
- | InvalidBip32PublicKeySize
- | InvalidBip32PrivateKeySize
- | InvalidBip32DerivationIndex
- | UnexpectedCborType
- | InvalidCborValue
- | InvalidCborArraySize
- | InvalidCborMapSize
- | DuplicateCborMapKey
- | InvalidCborMapKey
- | InvalidAddressType
- | InvalidAddressFormat
- | InvalidCredentialType
- | InvalidPlutusDataConversion
- | InvalidDatumType
- | InvalidScriptLanguage
- | InvalidNativeScriptType
- | InvalidPlutusCostModel
- | InvalidProposalProcedureType
- | InvalidMetadatumConversion
- | InvalidMetadatumTextStringSize
- | InvalidMetadatumBoundedBytesSize
- | InvalidHttpRequest
- | InsufficientBalance
- | UtxoNotFragmentedEnough
- | UtxoFullyDepleted
- | MaximumInputCountExceeded
- | UnbalancedSubTransactions
- | DisallowedSupplementalDatums
- | MissingRedeemer
- | ScriptEvaluationFailure
- fromNumber :: Integer -> ErrorCode
- toNumber :: ErrorCode -> Integer
- isKnown :: ErrorCode -> Bool
- knownCodes :: [ErrorCode]
Status codes
A native status code. Success represents a successful operation; all other
named constructors represent failures. Use fromNumber to construct a code
from any integer, and isKnown to distinguish named and unrecognized codes.
Equality distinguishes exact numeric codes. Show is diagnostic only.
Constructors
| Success | Successful operation. |
| GenericFailure | Generic error. |
| InsufficientBufferSize | Insufficient buffer size. |
| NullPointer | Operation over a null pointer. |
| MemoryAllocationFailed | Memory could not be allocated. |
| OutOfBoundsMemoryRead | Out of bounds memory read. |
| OutOfBoundsMemoryWrite | Out of bounds memory write. |
| InvalidArgument | Invalid argument. |
| InvalidUrl | Invalid URL. |
| ElementNotFound | Element not found. |
| EncodingFailure | Encoding failure. |
| DecodingFailure | Decoding failure. |
| ChecksumMismatch | Invalid checksum. |
| InvalidJson | Invalid JSON. |
| IntegerOverflow | An integer exceeds its upper bound. |
| IntegerUnderflow | An integer is below its lower bound. |
| ConversionFailed | Conversion error. |
| IndexOutOfBounds | Index out of bounds. |
| InvalidCertificateType | Invalid certificate type. |
| NotImplemented | The operation is not implemented. |
| InvalidPassphrase | The passphrase is invalid. |
| IllegalState | The state of the object is illegal. |
| DuplicateKey | The element is already present. |
| JsonTypeMismatch | The JSON type is unexpected. |
| LossOfPrecision | The serialization or deserialization process resulted in a loss of precision. |
| InvalidMagic | The magic number is invalid. |
| InvalidChecksum | The checksum is invalid. |
| InvalidBlake2bHashSize | The hash size is invalid. |
| InvalidEd25519SignatureSize | The Ed25519 signature size is invalid. |
| InvalidEd25519PublicKeySize | The Ed25519 public key size is invalid. |
| InvalidEd25519PrivateKeySize | The Ed25519 private key size is invalid. |
| InvalidBip32PublicKeySize | The BIP32 public key size is invalid. |
| InvalidBip32PrivateKeySize | The BIP32 private key size is invalid. |
| InvalidBip32DerivationIndex | The BIP32 derivation index is invalid. |
| UnexpectedCborType | The CBOR type is unexpected. |
| InvalidCborValue | The CBOR type is expected, but its value is invalid or out of range. |
| InvalidCborArraySize | The CBOR array size is invalid. |
| InvalidCborMapSize | The CBOR map size is invalid. |
| DuplicateCborMapKey | The CBOR map key is duplicated. |
| InvalidCborMapKey | The CBOR map key is invalid. |
| InvalidAddressType | The address type is invalid. |
| InvalidAddressFormat | The address format is invalid. |
| InvalidCredentialType | The credential type is invalid. |
| InvalidPlutusDataConversion | The Plutus data conversion is invalid. |
| InvalidDatumType | The Plutus datum type is invalid. |
| InvalidScriptLanguage | The script language is invalid. |
| InvalidNativeScriptType | The native script type is invalid. |
| InvalidPlutusCostModel | The Plutus cost model is invalid. |
| InvalidProposalProcedureType | The governance action type is invalid. |
| InvalidMetadatumConversion | The metadatum conversion is invalid. |
| InvalidMetadatumTextStringSize | The metadatum text string size is invalid. |
| InvalidMetadatumBoundedBytesSize | The metadatum bounded byte string size is invalid. |
| InvalidHttpRequest | The HTTP request is invalid. |
| InsufficientBalance | Available UTxO value is less than the requested output value. |
| UtxoNotFragmentedEnough | The selection algorithm requires more UTxO entries to cover the outputs. |
| UtxoFullyDepleted | Selection exhausted the available UTxO entries before covering all outputs. |
| MaximumInputCountExceeded | Progress would exceed the selection algorithm's maximum input count. |
| UnbalancedSubTransactions | Subtransactions do not conserve value as required by the batch. |
| DisallowedSupplementalDatums | The top-level transaction carries a witness datum disallowed for its batch. |
| MissingRedeemer | A Plutus script purpose in the transaction or its subtransactions lacks a redeemer. |
| ScriptEvaluationFailure | The transaction script evaluation failed. |
Numeric conversion
fromNumber :: Integer -> ErrorCode Source #
Interpret a numeric status code. Every integer is accepted, including negative values and values outside machine integer ranges, without truncation. A recognized number becomes its named constructor; all others remain unknown.
toNumber (fromNumber number) == number
toNumber :: ErrorCode -> Integer Source #
Return the exact numeric code. No conversion to a bounded machine integer
occurs. This is the inverse of fromNumber on all ErrorCode values.
Inspection
isKnown :: ErrorCode -> Bool Source #
Whether a code has a name in this build of the package.
This does not indicate success: use equality with Success for that purpose.
knownCodes :: [ErrorCode] Source #
Every named code, including Success, once each, in numeric order.
Unknown numeric codes are excluded. Values have gaps; do not infer a code
by adding to or subtracting from another code.