cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Error

Description

Validation and operation failures. Match constructors and status codes to handle errors; diagnostic messages are intended for people.

import qualified Cometa.Crypto.Blake2b as Blake2b
import qualified Data.ByteString as ByteString

main :: IO ()
main = case Blake2b.fromBytes ByteString.empty of
  Left err -> print err
  Right digest -> print digest
Synopsis

Documentation

data Error Source #

Expected failures returned by Cometa operations. Equality compares every payload, including diagnostic text. Show is diagnostic output.

Constructors

NativeError

An operation failed with a cardano-c status code. Unknown numeric codes remain available through toNumber in Cometa.Error.Code.

Fields

  • !Text

    Operation name, such as blake2b.compute; excludes user input.

  • !ErrorCode

    Exact status code, with a name when recognized.

  • !Text

    Diagnostic message; do not parse it to determine the failure.

InvalidBuildingRequest !Text

A transaction-building request has invalid context or inconsistent inputs.

InvalidTransactionPlan !Text

Transaction requirements conflict or cannot form a valid build request.

InvalidSlotConfig !Text

A slot configuration or conversion is outside its supported time range.

InvalidHashLength

The requested BLAKE2b digest length is outside 16 through 64 bytes.

Fields

  • !Int

    Requested digest length in bytes.

EmptyHash

The digest byte sequence is empty.

InvalidHex

Hexadecimal input is empty, has an odd number of digits, or contains characters other than ASCII hexadecimal digits. Both cases are accepted.

SigningKeyClosed

An Ed25519 signing-key operation used a handle that has been closed.

InvalidEd25519SigningKeyLength

An Ed25519 signing-key input has the wrong byte length for its format.

Fields

  • !Int

    Expected byte length: 32 for normal keys, or 64 for extended keys.

  • !Int

    Actual input byte length.

KeyHandlerClosed

A software key handler has closed.

KeyHandlerBusy

A software key handler already has an active operation.

InvalidKeyHandlerPasswordLength !Int

A software handler password is outside 1 through 128 bytes.

InvalidKeyHandlerStorage

Software storage framing, type or secret length is invalid.

InvalidEd25519PublicKeyLength

An Ed25519 public key does not contain exactly 32 bytes.

Fields

  • !Int

    Actual encoded byte length.

InvalidEd25519SignatureLength

An Ed25519 signature does not contain exactly 64 bytes.

Fields

  • !Int

    Actual encoded byte length.

Bip32PrivateKeyClosed

A BIP32 private-key handle has closed.

InvalidBip32PrivateKeyLength

A BIP32 private key must contain exactly 96 bytes.

Fields

  • !Int

    Actual byte count.

InvalidBip32PublicKeyLength

A BIP32 public key must contain exactly 64 bytes.

Fields

  • !Int

    Actual byte count.

InvalidBip39EntropyLength

BIP39 entropy must contain 16, 20, 24, 28 or 32 bytes.

Fields

  • !Int

    Actual byte count.

InvalidBip39WordCount

A mnemonic requires 12, 15, 18, 21 or 24 words.

Fields

  • !Int

    Actual number of words.

InvalidBip39Word

A mnemonic word is empty or contains characters outside lowercase ASCII.

Fields

  • !Int

    One-based word position; excludes the word itself.

UnknownBip39Word

At least one word is absent from the English BIP39 dictionary.

InvalidBip39Checksum

The mnemonic checksum does not agree with its entropy.

EmptyPbkdf2Salt

PBKDF2 requires a nonempty salt.

InvalidPbkdf2Iterations

PBKDF2 iteration count is outside 1 through 4294967295 inclusive.

Fields

InvalidPbkdf2OutputLength

PBKDF2 output byte count is outside its documented bounds.

Fields

  • !Integer

    Requested output byte count.

InvalidEmip3PlaintextLength

EMIP3 plaintext exceeds its documented size bounds.

Fields

  • !Int

    Actual plaintext byte count.

InvalidEmip3EnvelopeLength

EMIP3 envelope is outside its documented size bounds.

Fields

  • !Int

    Actual encoded byte count.

InvalidDerivationIndex

An unencoded derivation component is outside 0 through 2147483647.

Fields

  • !Integer

    Exact requested component number.

HardenedPublicDerivation

Public derivation requires soft indices below 2^31.

Fields

  • !Word32

    First hardened encoded index encountered.

InvalidCborInteger

A CBOR integer is outside the supported primitive range, from -2^64 through 2^64 - 1 inclusive. Tagged bignums are not encoded here.

Fields

InvalidCborUtf8

A decoded CBOR text string contains invalid UTF-8.

InvalidAssetNameLength !Int

A native-asset name exceeds 32 bytes.

InvalidAssetNameCbor !Text

Asset-name CBOR is malformed or does not contain a name of 0 through 32 bytes.

InvalidAssetIdLength !Int

A native-asset identity encoding does not contain 28 through 60 bytes.

InvalidPolicyIdLength !Int

A native-asset policy identifier does not contain exactly 28 bytes.

InvalidCredentialHashLength !Int

A credential hash does not contain exactly 28 bytes.

InvalidCredentialCbor !Text

A credential CBOR item has invalid syntax, shape or kind.

InvalidHashCbor !Text

A digest CBOR item has invalid syntax or is not one byte string.

InvalidNetworkId !Integer

A Shelley network tag is outside 0 through 15 inclusive.

UnsupportedAddressType !Word8

The four-bit header selects an address form unsupported by the chosen payment-address or reward-account decoder.

InvalidShelleyAddress

Address bytes are empty or have an incorrect exact length.

InvalidShelleyAddressText

Address text is malformed, mixed-case, has an invalid checksum or bit padding, or has a prefix inconsistent with its network/address form.

InvalidPlutusDataCbor !Text

Plutus data CBOR is malformed or contains unsupported data forms.

InvalidMetadataInteger !Integer

A metadata integer is outside -2^64 through 2^64 - 1 inclusive.

InvalidMetadataBytesLength !Int

A metadata byte string exceeds 64 bytes.

InvalidMetadataTextLength !Int

A metadata text string exceeds 64 UTF-8 bytes.

InvalidMetadataCbor !Text

Metadata CBOR is malformed or violates metadata bounds.

DuplicateMetadataLabel !Word64

A transaction metadata label occurs more than once.

InvalidMetadataJson !Text

Detailed metadata JSON is malformed or violates metadata bounds.

InvalidScriptCbor !Text

Script CBOR is malformed or has an unsupported script form.

InvalidScriptJson !Text

Native script construction JSON is malformed or violates script bounds.

EmptyPlutusScript

Compiled Plutus script bytes are empty.

InvalidProtocolRational !Integer !Integer

A protocol fraction has a negative or oversized component, or a zero denominator.

InvalidIntegerRadix !Int

An integer text radix or uppercase rendering radix is unsupported.

InvalidIntegerText !Text

Integer text contains invalid digits or no digits; payload is diagnostic.

InvalidModulus !Integer

A modular operation has a zero or otherwise unsupported modulus.

NoModularInverse !Integer !Integer

The given integer has no inverse for the given modulus.

InvalidProtocolDouble

A floating-point protocol fraction is nonfinite, negative or has an oversized whole part.

InvalidUnitIntervalDouble

A floating-point unit interval is nonfinite or outside zero through one.

InvalidUnitInterval !Integer !Integer

A unit interval fraction lies outside zero through one inclusive.

InvalidExUnits !Integer !Integer

An execution budget component is outside the unsigned 64-bit range.

InvalidProtocolVersion !Integer !Integer

A protocol version exceeds its unsigned major/minor bounds.

InvalidProtocolCbor !Text

A protocol value has malformed CBOR or violates its field constraints.

InvalidTransactionCbor !Text

Transaction CBOR is malformed or violates its field constraints.

InvalidTransactionOutputValue !Integer

A transaction output contains an unsupported quantity.

InvalidValueQuantity !Integer

A standalone value has Ada outside 0..2^63-1 or a native quantity outside int64.

InvalidValueCbor !Text

Standalone value CBOR is malformed or violates its quantity constraints.

InvalidGovernanceActionText !Text

Governance action identifier text is malformed or has an invalid prefix or payload.

InvalidGovernanceActionTextIndex !Word64

An action index exceeds the one-byte CIP-129 text representation.

InvalidDRepText !Text

A DRep identifier has an invalid checksum, prefix, header or payload.

InvalidTransactionHashLength !Int

A transaction digest does not contain exactly 32 bytes.

InvalidTransactionField !Text

A transaction field violates its domain constraints.

InvalidWitnessCbor !Text

Witness CBOR is malformed or violates its field constraints.

InvalidRedeemerCbor !Text

Redeemer CBOR is malformed or violates its field constraints.

InvalidAuxiliaryDataCbor !Text

Auxiliary data CBOR is malformed or violates its field constraints.

InvalidBootstrapChainCodeLength !Int

A bootstrap witness chain code does not contain 32 bytes.

WitnessConflict !Text

Witnesses contain conflicting values for the same identity.

InvalidByronAddress !Text

Byron address bytes or attributes are malformed or have a bad checksum.

InvalidByronAddressText

Byron address text is not a valid Base58 address.

ProviderHttpError !Text !Int

A backend rejected an HTTP request. The payload contains the operation name and HTTP status, without response bodies or credentials.

ProviderTransportError !Text !Text

A backend request could not complete. The payload contains the operation name and a credential-free description of the transport failure.

InvalidProviderResponse !Text

A backend response violates the named operation's data contract.

InvalidProviderConfiguration !Text

A backend configuration is invalid. The diagnostic excludes credentials.

UnsupportedOperation !Text

The requested service capability is not supplied.

RuntimeClosed

An operation used a resource after its scope ended.

RuntimeBusy

An overlapping operation is already using the same resource.

InvalidCallbackResult !Text

An injected callback returned a result outside its contract.

InvalidParameterSnapshot !Text

A parameter snapshot is incomplete or outside supported bounds.

InvalidSelectionRequest !Text

Coin-selection inputs are inconsistent or outside supported bounds.

InvalidSelection !Text

A selection violates eligibility, balance or change requirements.

InvalidEvaluationRequest !Text

An evaluation target or resolved input snapshot is inconsistent.

InvalidEvaluationResult !Text

Evaluation budgets do not match the transaction's redeemer identities.

InvalidPoolCbor !Text

Pool CBOR is malformed or violates a field constraint.

InvalidPoolHashLength !Int

A pool VRF key hash does not contain 32 bytes.

InvalidPoolMetadataUrl !Text

A pool metadata URL violates its byte-length or NUL constraint.

InvalidPoolMetadataHashLength !Int

A pool metadata hash does not contain 32 bytes.

InvalidPoolDnsName !Text

A relay DNS name violates its byte-length or NUL constraint.

InvalidPoolIpLength !Int !Int

An IP address has an incorrect byte count: expected, then actual.

InvalidPoolIpText !Text

An IP address text representation is malformed.

InvalidPoolBlsKeyLength

A BLS key or possession proof has an incorrect byte count.

Fields

  • !Int

    Actual public-key byte count; 96 is required.

  • !Int

    Actual possession-proof byte count; 48 is required.

InvalidCertificateCbor !Text

A certificate has malformed CBOR or invalid fields.

InvalidProposalCbor !Text

A governance proposal has malformed CBOR or invalid fields.

DuplicateTreasuryWithdrawal

A reward account occurs more than once in treasury withdrawals.

DuplicateCommitteeMember

A committee credential occurs more than once.

DuplicateProtocolUpdate

A genesis key occurs more than once in a proposed update map.

InvalidCostModelLength !Int

A cost model contains an unsupported number of coefficients.

InvalidProtocolParametersCbor !Text

A parameter update has malformed CBOR or invalid fields.

InvalidReferenceScriptCostStride !Integer

A reference script cost stride is outside 1 through 4294967295 bytes.

InvalidProtocolNonceLength !Int

A nonneutral protocol nonce does not contain exactly 32 bytes.

InvalidAnchorUrlLength !Int

An anchor URL is outside 1 through 128 UTF-8 bytes.

InvalidAnchorUrl

An anchor URL contains a NUL character.

InvalidAnchorDataHashLength !Int

An anchor data digest does not contain exactly 32 bytes.

InvalidTransactionIdLength !Int

A transaction identifier does not contain exactly 32 bytes.

InvalidGovernanceCbor !Text

Governance CBOR is malformed or violates the selected value's schema.

DuplicateGovernanceVote

A voter/action pair is present more than once.

NativeContractViolation

An operation reported success but did not produce a valid result.

Fields

  • !Text

    Operation name; excludes user input.

Instances

Instances details
Show Error Source # 
Instance details

Defined in Cometa.Error

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Cometa.Error

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #