Aug 13, 2022Kuina-chan


This is the language specification 14 of Kuin Programming Language, and is about exception codes.

1Kuin Exception Codes

The exception code used in Kuin is shown in Table 1-1.
Table 1-1: Kuin Exception Codes
Exception Code Constant Description
0x00000001

0x0000FFFF
excpt@userMin

excpt@userMax
Exception code at user's disposal.
0xC0000005 excpt@accessViolation Illegal memory access (mainly occurs when referencing a null instance).
0xC0000017 excpt@noMem Out of memory.
0xC0000094 excpt@intDivideByZero Occurs when dividing by 0 in an integer type such as int. Does not occur with float.
0xC00000FD excpt@stackOverflow Stack overflow (mainly caused by infinite recursive calls).
0xC000013A excpt@ctrlCExit Occurs when a user tries to exit with Ctrl+C in a console application.
0xE9170000 excpt@dbgAssertFailed Occurs when the conditional expression of the assert statement becomes false (debug mode only).
0xE9170001 excpt@classCastFailed Occurs when casting to a class that cannot be cast.
0xE9170002 excpt@dbgArrayIdxOutOfRange Occurs when accessing outside the array range (debug mode only).
0xE9170004 excpt@invalidCmp Occurs when comparing classes that do not inherit the cmp method.
0xE9170006 excpt@dbgArgOutDomain Arguments passed to the function are outside the definition range (debug mode only).
0xE9170007 excpt@fileOpenFailed Failed to open the file.
0xE9170008 excpt@invalidDataFmt Incorrect format of the loaded file or data.
0xE9170009 excpt@deviceInitFailed Failed to initialize devices, windows, etc.
0xE917000A excpt@dbgInoperableState The operation that is about to be performed is not ready to be performed (debug mode only).
0xE917000B excpt@creatingInvalidArray The number of elements in the array to be created is negative (debug mode only).
The above constants are defined in excpt.kn.
For exceptions that are difficult to deal with, such as 0xE9170009 (excpt@deviceInitFailed), you can let it exit without handling it.
1660384943enf