You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recodex-wiki/Exit-Code-Mappings.md

76 lines
3.5 KiB
Markdown

# Exit Code Mappings
For particular runtime environments ReCodEx can provide mappings of result codes to some custom messages. This is possible for example for Java, C# or Python where there can be custom wrappers/runners which might catch exceptions and then provide users more detailed information about evaluations.
## Free Pascal
Actually, the FPC itself returns a specific code when a runtime error is encountered. All exit codes on the runtime errors list are translated into corresponding strings according to FPC documentation: [https://www.freepascal.org/docs-html/user/userap4.html](https://www.freepascal.org/docs-html/user/userap4.html)
## Java
Runner: https://github.com/ReCodEx/utils/blob/master/runners/java/javarun.java
| Exit Code | Exception | Mapping |
| --------- | --------- | ------- |
| 0 | --- | OK |
| 1 | Throwable | Unknown error |
| 2 | InvocationTargetException | Other invocation target exception |
| 100 | OutOfMemoryError | Out of memory exception |
| 101 | SecurityException | Security exception |
| 102 | --- | Main class not found exception |
| 103 | --- | Multiple main classes found |
| 104 | IllegalAccessException | Illegal access exception |
| 105 | IllegalArgumentException | Illegal argument exception |
| 106 | StackOverflowError | Stack overflow exception |
| 107 | ArrayIndexOutOfBoundsException | Array index out of bounds exception |
| 108 | IndexOutOfBoundsException | Index out of bounds exception |
| 109 | NullPointerException | Null pointer exception |
| 110 | ArithmeticException | Arithmetic exception |
| 111 | OutOfMemoryError | Out of memory error (after invocation) |
| 112 | SecurityException | Security exception (after invocation) |
| 113 | IOException | IO exception |
## C#
Runner: https://github.com/ReCodEx/utils/blob/master/runners/cs/Wrapper.cs
| Exit Code | Exception | Mapping |
| --------- | --------- | ------- |
| 0 | --- | OK |
| 1 | --- | User error |
| 101 | TargetInvocationException | Unhandled exception |
| 102 | NullReferenceException | Null reference error |
| 103 | OutOfMemoryException | Memory allocation error |
| 104 | IndexOutOfRangeException | Index out of range error |
| 105 | OverflowException | Overflow error |
| 106 | IOException | IO error |
| 107 | FileNotFoundException | File not found error |
| 108 | InvalidOperationException | Invalid operation error |
| 109 | DivideByZeroException | Division by zero error |
| 200 | Exception | Internal error |
| 201 | --- | No main method |
| 202 | --- | More main methods |
## Python3
Runner: https://github.com/ReCodEx/utils/blob/master/runners/py/runner.py
| Exit Code | Exception | Mapping |
| --------- | --------- | ------- |
| 0 | --- | OK |
| 1 | BaseException | Unhandled exception |
| 101 | AssertionError | An assertion failed |
| 102 | TypeError | Type error (a different type was expected) |
| 103 | NameError | Name not found error (an undefined name was used) |
| 104 | EOFError | End of file error (`input()` encountered an EOF) |
| 105 | AttributeError | Attribute access failed |
| 106 | IOError | IO error |
| 107 | OSError | OS returned an error (including filesystem access errors) |
| 108 | LookupError | Lookup error (invalid key or index was used in a data structure) |
| 109 | ValueError | Value error (invalid value of the right type was encountered) |
| 110 | ZeroDivisionError | Zero division error |
| 111 | ArithmeticError | Arithmetic error |
| 112 | ImportError | Import error (an unknown or forbidden module was imported) |
| 113 | MemoryError | Memory allocation error |
| 114 | SyntaxError | Syntax error |