runtime_error_handling.rst 749 B

1234567891011121314151617
  1. .. _embedding_runtime_error_handling:
  2. ======================
  3. Runtime error handling
  4. ======================
  5. When an exception is not handled by Squirrel code with a try/catch statement, a runtime
  6. error is raised and the execution of the current program is interrupted. It is possible to
  7. set a call back function to intercept the runtime error from the host program; this is
  8. useful to show meaningful errors to the script writer and for implementing visual
  9. debuggers.
  10. The following API call pops a Squirrel function from the stack and sets it as error handler.::
  11. SQUIRREL_API void sq_seterrorhandler(HSQUIRRELVM v);
  12. The error handler is called with 2 parameters, an environment object (this) and a object.
  13. The object can be any squirrel type.