File: runtime_error_handling.rst

package info (click to toggle)
squirrel3 3.1-8.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,380 kB
  • sloc: cpp: 12,722; ansic: 917; makefile: 316; python: 40
file content (17 lines) | stat: -rw-r--r-- 749 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.. _embedding_runtime_error_handling:

======================
Runtime error handling
======================

When an exception is not handled by Squirrel code with a try/catch statement, a runtime
error is raised and the execution of the current program is interrupted. It is possible to
set a call back function to intercept the runtime error from the host program; this is
useful to show meaningful errors to the script writer and for implementing visual
debuggers.
The following API call pops a Squirrel function from the stack and sets it as error handler.::

    SQUIRREL_API void sq_seterrorhandler(HSQUIRRELVM v);

The error handler is called with 2 parameters, an environment object (this) and a object.
The object can be any squirrel type.