Factors exception hierarchy into reusable fragment.

The fragment with hyperlinks is included now from the system module.
This commit is contained in:
Grzegorz Adam Hankiewicz 2014-08-05 17:59:28 +02:00
commit f3d785b5cf
3 changed files with 187 additions and 126 deletions

View file

@ -0,0 +1,31 @@
* `E_Base <system.html#E_Base>`_
* `EAccessViolation <system.html#EAccessViolation>`_
* `EArithmetic <system.html#EArithmetic>`_
* `EDivByZero <system.html#EDivByZero>`_
* `EOverflow <system.html#EOverflow>`_
* `EAssertionFailed <system.html#EAssertionFailed>`_
* `EAsynch <system.html#EAsynch>`_
* `EControlC <system.html#EControlC>`_
* `EDeadThread <system.html#EDeadThread>`_
* `EFloatingPoint <system.html#EFloatingPoint>`_
* `EFloatDivByZero <system.html#EFloatDivByZero>`_
* `EFloatInexact <system.html#EFloatInexact>`_
* `EFloatInvalidOp <system.html#EFloatInvalidOp>`_
* `EFloatOverflow <system.html#EFloatOverflow>`_
* `EFloatUnderflow <system.html#EFloatUnderflow>`_
* `EInvalidField <system.html#EInvalidField>`_
* `EInvalidIndex <system.html#EInvalidIndex>`_
* `EInvalidObjectAssignment <system.html#EInvalidObjectAssignment>`_
* `EInvalidObjectConversion <system.html#EInvalidObjectConversion>`_
* `EInvalidValue <system.html#EInvalidValue>`_
* `EInvalidKey <system.html#EInvalidKey>`_
* `ENoExceptionToReraise <system.html#ENoExceptionToReraise>`_
* `EOutOfRange <system.html#EOutOfRange>`_
* `ESynch <system.html#ESynch>`_
* `EOutOfMemory <system.html#EOutOfMemory>`_
* `EResourceExhausted <system.html#EResourceExhausted>`_
* `EStackOverflow <system.html#EStackOverflow>`_
* `ESystem <system.html#ESystem>`_
* `EIO <system.html#EIO>`_
* `EOS <system.html#EOS>`_
* `EInvalidLibrary <system.html#EInvalidLibrary>`_

View file

@ -443,39 +443,9 @@ Exception hierarchy
If you want to create your own exceptions you can inherit from E_Base, but you If you want to create your own exceptions you can inherit from E_Base, but you
can also inherit from one of the existing exceptions if they fit your purpose. can also inherit from one of the existing exceptions if they fit your purpose.
The exception tree is:: The exception tree is:
* E_Base .. include:: exception_hierarchy_fragment.txt
* EAsynch
* EControlC
* ESynch
* ESystem
* EIO
* EOS
* EInvalidLibrary
* EResourceExhausted
* EOutOfMemory
* EStackOverflow
* EArithmetic
* EDivByZero
* EOverflow
* EAccessViolation
* EAssertionFailed
* EInvalidValue
* EInvalidKey
* EInvalidIndex
* EInvalidField
* EOutOfRange
* ENoExceptionToReraise
* EInvalidObjectAssignment
* EInvalidObjectConversion
* EFloatingPoint
* EFloatInvalidOp
* EFloatDivByZero
* EFloatOverflow
* EFloatUnderflow
* EFloatInexact
* EDeadThread
See the `system <system.html>`_ module for a description of each exception. See the `system <system.html>`_ module for a description of each exception.

View file

@ -13,6 +13,21 @@
## Each module implicitly imports the System module; it must not be listed ## Each module implicitly imports the System module; it must not be listed
## explicitly. Because of this there cannot be a user-defined module named ## explicitly. Because of this there cannot be a user-defined module named
## ``system``. ## ``system``.
##
## Exception hierarchy
## ===================
##
## For visual convenience here is the exception inheritance hierarchy
## represented as a tree:
##
## .. include:: ../doc/exception_hierarchy_fragment.txt
##
## Module system
## =============
##
# That lonesome header above is to prevent :idx: entries from being mentioned
# in the global index as part of the previous header (Exception hierarchy).
type type
int* {.magic: Int.} ## default integer type; bitwidth depends on int* {.magic: Int.} ## default integer type; bitwidth depends on
@ -301,9 +316,11 @@ type
FWriteIO* = object of FIO ## Effect describing a write IO operation. FWriteIO* = object of FIO ## Effect describing a write IO operation.
FExecIO* = object of FIO ## Effect describing an executing IO operation. FExecIO* = object of FIO ## Effect describing an executing IO operation.
E_Base* {.compilerproc.} = object of TObject ## base exception class; E_Base* {.compilerproc.} = object of TObject ## \
## each exception has to ## Base exception class.
## inherit from `E_Base`. ##
## Each exception has to inherit from `E_Base`. See the full `exception
## hierarchy`_.
parent: ref E_Base ## parent exception (can be used as a stack) parent: ref E_Base ## parent exception (can be used as a stack)
name: cstring ## The exception's name is its Nimrod identifier. name: cstring ## The exception's name is its Nimrod identifier.
## This field is filled automatically in the ## This field is filled automatically in the
@ -313,98 +330,141 @@ type
## is bad style. ## is bad style.
trace: string trace: string
EAsynch* = object of E_Base ## Abstract exception class for EAsynch* = object of E_Base ## \
## *asynchronous exceptions* (interrupts). ## Abstract exception class for *asynchronous exceptions* (interrupts).
## This is rarely needed: Most ##
## exception types inherit from `ESynch` ## This is rarely needed: most exception types inherit from `ESynch
ESynch* = object of E_Base ## Abstract exception class for ## <#ESynch>`_. See the full `exception hierarchy`_.
## *synchronous exceptions*. Most exceptions EControlC* = object of EAsynch ## \
## should be inherited (directly or indirectly) ## Raised for Ctrl+C key presses in console applications.
## from ESynch. ##
ESystem* = object of ESynch ## Abstract class for exceptions that the runtime ## See the full `exception hierarchy`_.
## system raises. ESynch* = object of E_Base ## \
EIO* = object of ESystem ## raised if an IO error occured. ## Abstract exception class for *synchronous exceptions*.
EOS* = object of ESystem ## raised if an operating system service failed. ##
## Most exceptions should be inherited (directly or indirectly) from
## `ESynch` instead of from `EAsynch <#EAsynch>`_. See the full `exception
## hierarchy`_.
ESystem* = object of ESynch ## \
## Abstract class for exceptions that the runtime system raises.
##
## See the full `exception hierarchy`_.
EIO* = object of ESystem ## \
## Raised if an IO error occured.
##
## See the full `exception hierarchy`_.
EOS* = object of ESystem ## \
## Raised if an operating system service failed.
##
## See the full `exception hierarchy`_.
errorCode*: int32 ## OS-defined error code describing this error. errorCode*: int32 ## OS-defined error code describing this error.
EInvalidLibrary* = object of EOS ## raised if a dynamic library EInvalidLibrary* = object of EOS ## \
## could not be loaded. ## Raised if a dynamic library could not be loaded.
EResourceExhausted* = object of ESystem ## raised if a resource request ##
## could not be fullfilled. ## See the full `exception hierarchy`_.
EArithmetic* = object of ESynch ## raised if any kind of arithmetic EResourceExhausted* = object of ESystem ## \
## error occured. ## Raised if a resource request could not be fullfilled.
EDivByZero* {.compilerproc.} = ##
object of EArithmetic ## is the exception class for integer divide-by-zero ## See the full `exception hierarchy`_.
## errors. EArithmetic* = object of ESynch ## \
EOverflow* {.compilerproc.} = ## Raised if any kind of arithmetic error occured.
object of EArithmetic ## is the exception class for integer calculations ##
## whose results are too large to fit in the ## See the full `exception hierarchy`_.
## provided bits. EDivByZero* {.compilerproc.} = object of EArithmetic ## \
## Raised for runtime integer divide-by-zero errors.
EAccessViolation* {.compilerproc.} = ##
object of ESynch ## the exception class for invalid memory access errors ## See the full `exception hierarchy`_.
EOverflow* {.compilerproc.} = object of EArithmetic ## \
EAssertionFailed* {.compilerproc.} = ## Raised for runtime integer overflows.
object of ESynch ## is the exception class for Assert ##
## procedures that is raised if the ## This happens for calculations whose results are too large to fit in the
## assertion proves wrong ## provided bits. See the full `exception hierarchy`_.
EAccessViolation* {.compilerproc.} = object of ESynch ## \
EControlC* = object of EAsynch ## is the exception class for Ctrl+C ## Raised for invalid memory access errors
## key presses in console applications. ##
## See the full `exception hierarchy`_.
EInvalidValue* = object of ESynch ## is the exception class for string EAssertionFailed* {.compilerproc.} = object of ESynch ## \
## and object conversion errors. ## Raised when assertion is proved wrong.
EInvalidKey* = object of EInvalidValue ## is the exception class if a key ##
## cannot be found in a table. ## Usually the result of using the `assert() template <#assert>`_. See the
## full `exception hierarchy`_.
EOutOfMemory* = object of ESystem ## is the exception class for EInvalidValue* = object of ESynch ## \
## unsuccessful attempts to allocate ## Raised for string and object conversion errors.
## memory. EInvalidKey* = object of EInvalidValue ## \
## Raised if a key cannot be found in a table.
EInvalidIndex* = object of ESynch ## is raised if an array index is out ##
## of bounds. ## Mostly used by the `tables <tables.html>`_ module, it can also be raised
EInvalidField* = object of ESynch ## is raised if a record field is not ## by other collection modules like `sets <sets.html>`_ or `strtabs
## accessible because its dicriminant's ## <strtabs.html>`_. See the full `exception hierarchy`_.
EOutOfMemory* = object of ESystem ## \
## Raised for unsuccessful attempts to allocate memory.
##
## See the full `exception hierarchy`_.
EInvalidIndex* = object of ESynch ## \
## Raised if an array index is out of bounds.
##
## See the full `exception hierarchy`_.
EInvalidField* = object of ESynch ## \
## Raised if a record field is not accessible because its dicriminant's
## value does not fit. ## value does not fit.
##
EOutOfRange* = object of ESynch ## is raised if a range check error ## See the full `exception hierarchy`_.
## occurred. EOutOfRange* = object of ESynch ## \
## Raised if a range check error occurred.
EStackOverflow* = object of ESystem ## is raised if the hardware stack ##
## used for subroutine calls overflowed. ## See the full `exception hierarchy`_.
EStackOverflow* = object of ESystem ## \
ENoExceptionToReraise* = object of ESynch ## is raised if there is no ## Raised if the hardware stack used for subroutine calls overflowed.
## exception to reraise. ##
## See the full `exception hierarchy`_.
EInvalidObjectAssignment* = ENoExceptionToReraise* = object of ESynch ## \
object of ESynch ## is raised if an object gets assigned to its ## Raised if there is no exception to reraise.
## parent's object. ##
## See the full `exception hierarchy`_.
EInvalidObjectConversion* = EInvalidObjectAssignment* = object of ESynch ## \
object of ESynch ## is raised if an object is converted to an incompatible ## Raised if an object gets assigned to its parent's object.
## object type. ##
## See the full `exception hierarchy`_.
EFloatingPoint* = object of ESynch ## base class for floating point exceptions EInvalidObjectConversion* = object of ESynch ## \
EFloatInvalidOp* {.compilerproc.} = ## Raised if an object is converted to an incompatible object type.
object of EFloatingPoint ## Invalid operation according to IEEE: Raised by ##
## 0.0/0.0, for example. ## See the full `exception hierarchy`_.
EFloatDivByZero* {.compilerproc.} = EFloatingPoint* = object of ESynch ## \
object of EFloatingPoint ## Division by zero. Divisor is zero and dividend ## Base class for floating point exceptions.
## is a finite nonzero number. ##
EFloatOverflow* {.compilerproc.} = ## See the full `exception hierarchy`_.
object of EFloatingPoint ## Overflow. Operation produces a result EFloatInvalidOp* {.compilerproc.} = object of EFloatingPoint ## \
## that exceeds the range of the exponent ## Raised by invalid operations according to IEEE.
EFloatUnderflow* {.compilerproc.} = ##
object of EFloatingPoint ## Underflow. Operation produces a result ## Raised by ``0.0/0.0``, for example. See the full `exception
## that is too small to be represented as ## hierarchy`_.
## a normal number EFloatDivByZero* {.compilerproc.} = object of EFloatingPoint ## \
EFloatInexact* {.compilerproc.} = ## Raised by division by zero.
object of EFloatingPoint ## Inexact. Operation produces a result ##
## that cannot be represented with infinite ## Divisor is zero and dividend is a finite nonzero number. See the full
## precision -- for example, 2.0 / 3.0, log(1.1) ## `exception hierarchy`_.
## NOTE: Nimrod currently does not detect these! EFloatOverflow* {.compilerproc.} = object of EFloatingPoint ## \
EDeadThread* = ## Raised for overflows.
object of ESynch ## is raised if it is attempted to send a message to a ##
## dead thread. ## The operation produced a result that exceeds the range of the exponent.
## See the full `exception hierarchy`_.
EFloatUnderflow* {.compilerproc.} = object of EFloatingPoint ## \
## Raised for underflows.
##
## The operation produced a result that is too small to be represented as a
## normal number. See the full `exception hierarchy`_.
EFloatInexact* {.compilerproc.} = object of EFloatingPoint ## \
## Raised for inexact results.
##
## The operation produced a result that cannot be represented with infinite
## precision -- for example: ``2.0 / 3.0, log(1.1)``
##
## **NOTE**: Nimrod currently does not detect these! See the full
## `exception hierarchy`_.
EDeadThread* = object of ESynch ## \
## Raised if it is attempted to send a message to a dead thread.
##
## See the full `exception hierarchy`_.
TResult* = enum Failure, Success TResult* = enum Failure, Success