On this page
DocumentationReference

Error reference

calculateSafe returns native Result: Success carries success; Failure carries failure. Expected local calculation errors are CalculationError; explicit decodeInput reports InputValidationError. The plain Promise host adds safe unexpected, closed-client and disposal errors. Native Effect keeps its defect and interruption semantics.

Money constructors and arithmetic return MoneyError, with closed reasons for format, fractional cents, non-finite input, range, negative input and overflow. A CalculationError means the scenario cannot be calculated. Its reason is period-mismatch or the MoneyError reason that caused it, such as negative when salary sacrifice exceeds gross pay. A fault inside TaxKit itself is not a CalculationError: Effect reports it as a defect, the plain interface returns TaxKitUnexpectedError and the HTTP API answers 500.

HTTP errors

The generated HTTP client receives declared calculator failures in CalculatorApiErrorEnvelope. Input issues have fixed messages and bounded paths; rejected amounts, opaque causes and private diagnostics are excluded.

JSON
{
  "error": {
    "_tag": "InputValidationError",
    "message": "Invalid calculator input.",
    "issues": [
      {
        "path": ["payload", "facts", "grossPay"],
        "message": "Invalid input value"
      }
    ],
    "truncated": false
  }
}

Retrieve the calculator schema endpoint for descriptor-backed field guidance. See API errors and validation.