Skip to main content

Exceptions

The Exceptions group exposes the modified PascalScript runtime's current exception record. It supports deliberate exception creation, re-raising the saved exception from a handler, and reading low-level type, parameter, procedure and position values while an exception handler is active.

Common tasks

Handler context

The inspection functions describe runtime exception state, not an independent historical error service. Their meaningful values depend on an active PascalScript exception-handler frame. ExceptionProc is an internal procedure index, and ExceptionPos is a low-level runtime position value that can be a sentinel rather than a user-facing source line or column. Do not persist either as a stable cross-build identifier.

RaiseLastException also depends on saved handler state. Read its page before calling it outside a handler or after nested exception processing has changed which frame is current.

Control flow and logging

Raising or re-raising transfers control through PascalScript exception handling. It does not automatically:

  • add a Velox flow-log item;
  • choose a business issue/status;
  • roll back database or file side effects;
  • cancel every map/view; or
  • make an internal exception safe to disclose publicly.

Use the appropriate Logging, Data and Program control contracts when those effects are also required. Avoid exposing raw exception parameters to users or external systems without reviewing them for file paths, SQL, customer values or other sensitive implementation detail.

Catch only exceptions that the script can handle meaningfully. A catch-and-ignore block can leave partially mutated data or external side effects while hiding the actual failure.