Class FormulaFormatException
- All Implemented Interfaces:
Serializable
This is a wire-format error, not a syntax error. A syntax error is a FormulaException and carries the offset and length of the offending span in the source text, because a human wrote that text and will be shown where it went wrong. There is no source text here and no human to show it to: the stream came from the other side of the connection, and the only useful questions are WHAT was wrong with it and whether the other side agrees that it was wrong.
Why a reason token and not just a message. The Golden Gate conformance corpus requires both implementations to refuse a malformed stream AND to refuse it FOR THE SAME REASON -- a codec that agrees on valid input and disagrees on invalid input is still a wire-format bug, because one side goes on to evaluate a stream the other refused and answers with a plausible wrong number rather than an error. Asserting that across two languages by matching message TEXT would couple the corpus to Java's wording and break on the first rephrasing. getReason() is a stable identifier; the message stays free to be as readable as it likes.
It extends IllegalArgumentException deliberately, so that every existing catch and every existing assertThrows(IllegalArgumentException.class, ...) keeps working unchanged; only code that wants the classification needs to know about this subclass.
- Author:
- Christopher Mindus
- See Also:
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReason: a constant index out of order or out of range.static final StringReason: a program that does not leave exactly one value on the stack.static final StringReason: a peak evaluation depth aboveFormula.MAX_STACK_DEPTH.static final StringReason: an instruction whose operands are not on the stack.static final StringReason: an opcode outside the flat space 1 toOp.OP_LAST.Constructor Summary
ConstructorsMethod Summary
Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Field Details
UNKNOWN_OPCODE
Reason: an opcode outside the flat space 1 toOp.OP_LAST.- See Also:
STACK_UNDERFLOW
Reason: an instruction whose operands are not on the stack.- See Also:
STACK_NOT_ONE
Reason: a program that does not leave exactly one value on the stack.- See Also:
STACK_TOO_DEEP
Reason: a peak evaluation depth aboveFormula.MAX_STACK_DEPTH.The most consequential of the five on the client, where the evaluation stack is a fixed
Float64Arrayallocated once and never bounds-checked at evaluation time. Writing past a typed array in JavaScript is a SILENT no-op, so without this check a too-deep program lays a component out at a wrong size with nothing reported anywhere.- See Also:
CONSTANT_INDEX
Reason: a constant index out of order or out of range.- See Also:
Constructor Details
FormulaFormatException
Method Details
getReason
Gets the stable reason token.- Returns:
- One of
UNKNOWN_OPCODE,STACK_UNDERFLOW,STACK_NOT_ONE,STACK_TOO_DEEPorCONSTANT_INDEX.