• Files
  • Threads
  • Codex
  • Geometry 2D
  • Properties

  • Arrays
  • Strings
  • Primitives
  • Exceptions
  • Time



Exceptions

Exceptions follow a subclassing hierarchy in Guildhall. The base class is TGuildhallException. If this is thrown Guildhall will quit, announcing the module and line number to the user on a final screen.

TAppletException subclasses from TGuildhallException. When this is thrown, the applet has failed and must be cleaned up. This level needs to be further developed before being really useful (August 2021).

TException subclasses from TAppletException. This error is recoverable if the applet is set up to handle such things. The console applet Terminus does a pretty good job with this. It can catch a number of errors and print the error message to the console without failing.

Subclasses of TException are used to identify certain kinds of problems and allow the applet to discern among them. A couple of examples would be TStreamException and its subclass TFileException. These are very handy when an applet's coding understands that these exceptions can be thrown. The applet can then respond accordingly, for example by asking the user to confirm when a file is about to be overwritten after an exception was thrown when writing the file was attempted.

Guildhall will also catch and rethrow any exception not in its hierarchy, the purpose of catching it being to aid debugging.

Guildhall offers several routines to assist in checking errors. The two most common ones are AssertOrFail and AssertOrThrow. Each one tests a boolean and if the test does not pass an exception is thrown. The file name and the line number of the assertion are provided in the exception. AssertOrFail throws a TGuildhallException and AssertOrThrow throws a TException. These same exceptions can be generated easily without the boolean test when logic so dictates, the former with the NotImplemented inline and the latter with IllegalOperation inline.

Constructible Classes


Exception Class

Derives From

Occurrence (Action)

TGuildhallException

 

coding failure, unrecoverable error (quit)

TAppletException

TGuildhallException

applet failure (terminate applet)

TException

TAppletException

general failure (may be recoverable)

TMemoryException

TException

when memory allocation fails

TSystemException

TException

when a host service fails

TStreamException

TException

when a stream operation fails

TFileException

TStreamException

when a file operation fails

TResourceException

TStreamException

when a resource operation fails

TArchiveException

TStreamException

when an archive operation fails

TTimeoutException

TException

when an timed operation times out


 

Copyright © 1981-2021 Arthur W Cabral. All Rights Reserved. All referenced trademarks are the property of their respective owners. This site does not use cookies. This site does not collect visitor information. The ISP hosting this site collects statistics regarding visitors to this site as part of the normal operation of the website. We do not currently examine those statistics. If that changes, this notice will change.