|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles | Qt Script for Applications | ![]() |
[Prev: case] [Home] [Next: continue]
try { Statements; } catch( exception ) { ExceptionStatements; }
This keyword is used in try statements. If an exception occurs, then the ExceptionStatements in a matching catch block are executed.
Catch blocks come in two varieties, unqualified and qualified. An unqualified catch block has the form:
catch ( e ) { /* statements */ }
and a qualified catch block has the form:
catch ( e if e instanceOf RangeError ) { /* statements */ }
The possible exception types are:
EvalError -- the result of a failed eval() call.
RangeError -- a result that is out of range, e.g. an array index to an element that isn't in the array.
TypeError -- an attempt to perform an operation on an object of an inappropriate type.
User defined exceptions -- exceptions that are objects of a user-defined type.
See try for an example.
[Prev: case] [Home] [Next: continue]
Copyright © 2001-2006 Trolltech | Trademarks | QSA version 1.1.5
|