Skip to main content

Module failure

Module failure 

Source
Expand description

The sentences a program stops with, written once for every tier.

This is the lowest crate every engine and every compiled program links, so a runtime failure’s wording lives here and nowhere else: the interpreter and the VM report these strings, the generated Rust panics with them, and the hosts written in other languages are generated from them (logicaffeine_compile::semantics::failcode).

A broken contract (Require that c, otherwise r.) reports its reason, which must be Text. Every engine refuses a non-Text reason with the same sentence, naming the LOGOS type it got, so the compiled tier routes the reason value through contract_reason. A type with no implementation here does not compile — never a report in the wrong words.

Constants§

BITAND_OPERANDS
The reason & stops a program: an operand it has no bits for (a negative big integer, a big integer beside a value that is not a low mask 2^k - 1, or a kind & does not combine).
BITOR_OPERANDS
The reason | stops a program: a big integer, or a kind | does not combine.
BITXOR_OPERANDS
The reason ^ (xor) stops a program: a big integer, or a kind it does not combine.
CALL_DEPTH_EXCEEDED
The reason a program stops when its calls nest deeper than its stack holds: the interpreter and the VM at their call-depth limit, a compiled program at the end of its stack.
DIVIDE_BY_ZERO_QUANTITY
A quantity divided by a quantity whose magnitude is zero.
DIVIDE_MONEY_BY_ZERO
Money divided by the number zero.
DIVIDE_MONEY_BY_ZERO_AMOUNT
Money divided by money whose amount is zero.
DIVIDE_QUANTITY_BY_ZERO
A quantity divided by the number zero.
DIVISION_BY_ZERO
The reason an integer division by zero stops a program.
INT_TOO_WIDE
The reason a compiled program stops when an integer past a machine word reaches a place it holds one.
MODULO_BY_ZERO
The reason an integer remainder by zero stops a program.
MODULUS_NOT_POSITIVE
modular(v, m) with m <= 0.
NO_EXCHANGE_RATES
A conversion with no rates in scope at all.
NO_MODULAR_INVERSE
A modular division whose divisor shares a factor with the modulus.
SET_FIELD_ON_NON_RECORD
The stop for setting a field of a value that is not a record.
SHL_OPERANDS
The reason a left shift stops a program: an operand that is not a machine-word integer.
SHR_OPERANDS
The reason a right shift stops a program: an operand that is not a machine-word integer.

Traits§

ContractReason
A value that can stand after otherwise.
FailureText
A value as a failure sentence names it: exactly as Show prints it.

Functions§

answered
The value an operation of the exact extension answered, or the stop its refusal names: the sentence the interpreter reports for the same operation on the same values.
cannot_convert
convert(q, unit) to a unit of another dimension: the quantity’s own unit and the one asked for.
cannot_read_bytes
readBytes(path) on a file that cannot be read, with the reason the system gave.
contract_reason
The report a broken contract stops with.
currencies_differ
verb (add, subtract, compare) applied to money in two currencies.
decimal_needs_text_or_int
decimal(…) given a value of another kind than Text, Int or Decimal, named as the engines name it.
field_access_on
The stop for reading a field of a value that is not a record: a value of type_name.
found
The value a map lookup found for key, or the stop key_not_found names.
index_out_of_bounds
The reason an index outside a sequence or a text stops a program: the index as the program wrote it (1-based, or negative from the end).
invalid_utf8
The reason text_from_bytes stops a program whose bytes are not UTF-8: the decoder’s own account of where they stop being it.
invalid_uuid
Text that is not a UUID.
key_not_found
The reason reading a key a map does not hold stops a program: the key as Show prints it.
modular_rings_differ
op (add, subtract, multiply, divide) applied to two residues of different moduli.
no_exchange_rate
A conversion between two currencies with no rate for either in scope.
not_a_decimal
Text decimal(…) cannot read as a base-10 number.
not_a_timestamp
Text that is not an RFC 3339 timestamp.
pop_from_empty
The reason popping a list with no items stops a program: the list as the program writes it (xs, b's items).
quantities_differ
verb (add, subtract) applied to two quantities whose dimensions differ.
quantities_uncomparable
Two quantities compared across dimensions.
unknown_currency
A currency code no currency table holds.
unknown_time_zone
A time zone name no zone table holds.
unknown_unit
A unit name no unit table holds.
uuid_needs_16_bytes
uuid_from_bytes given the wrong number of bytes.