Exception Handling

C Styled Script
Reference Manual

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using The CSS Executive
Language
   Comments
   Literals
   Var And Const
   Operators
   Statements And blocks
   Program Flow
   Exception Handling
      Between CSS And C API
      Between CSS And C++ API
   Functions
   Predefined Identifiers
Directives
System Library
String Library
Regular Expression Lib.
File Library
Database Library
C API
C++ API
CSS Links
  

Exceptions are handled by try/catch/throw as known by C++ and JAVA:

foo()
{
  try {
    ....
    var exc = { 'error in foo:', 'the message' };
    throw exc;
    ....
  } // try
  catch (const xx[]) {
    for (var i = 0; i < sizeof xx; i++)
      sysLog(xx[i]);
  } // catch
} // foo

Unlike C++ there may only be one catch block following the try block. The reason is, that there is only one variable type in CSS and it makes no sense to define several catch blocks.

throw must be followed by an identifier name or an expression as argument. The identifier may be any simple var/const, or array with any number of dimensions.

catch expects an identifier followed by empty braces [ ] as parameter. No matter what number of dimensions the thrown value had, the cought value will be a one-dimensional array.

 Copyright © IBK LandquartLast revised by Peter Koch, 24.02.00<< Back  Top  Next >>