Errors
Errors
Let's abandon the numbers and just create an Exception class inheritance tree, like Python has. It works.
Ratscript Error Codes
Error codes are organized numerically, to create ranges.
GENERAL | SPECIFIC | ERROR
2110
2: Math and Logic (General Category)
1: Non-Decimal Math Error (Specific Category)
01: Invalid Hexadecimal (Specific Error)
Compiler Errors (0xxx)
Code | Name | Info |
---|---|---|
0000 | Unknown Error | WARNING: Don't use me. |
Name Errors (00xx)
Code | Name | Info |
---|---|---|
0001 | Reserved Name | Name is reserved keyword. |
0002 | Library Name Conflict | Name already exists in Ratscript common library. |
0003 | Name Conflict | Name already exists. |
0004 | Illegal Name | Cannot give literal as name (3, true, “Bob” vs. Bob) |
0005 | Invalid Name | Names may only contain alphanumeric and _. |
Type Errors (01xx)
Code | Name | Info |
---|---|---|
0100 | Type Error | Mismatched type. |
0101 | Cast Error | Cannot cast. |
0102 | Null Error | Null passed where value expected. No value defined in variable/constant. |
Function Errors (03xx)
Code | Name | Info |
---|---|---|
0300 | Function Call Error | General function call error. |
0301 | Missing Argument | One or more arguments are missing. |
0302 | Late Required Argument | Required arguments must precede optional arguments. |
Access Errors (04xx)
Code | Name | Info |
---|---|---|
0400 | Access Error | General access error. |
0401 | Out of Scope | Cannot access variable/function/constant out of scope. |
0402 | (?) | |
0403 | Illegal Assignment | Attempting to write to a constant or literal. |
0404 | Reference Error | Variable/Constant/Function not found. |
Syntax Errors (1xxx)
Expected Token (10xx)
Code | Name | Info |
---|---|---|
1000 | Expected Token | General expected token error. |
1001 | Opening Bracket Expected | Missing |
1002 | Closing Bracket Expected | Missing ] |
1003 | Opening Parenthesis Expected | Missing ( |
1004 | Closing Parenthesis Expected | Missing ) |
1005 | Opening Brace Expected | Missing { |
1006 | Closing Brace Expected | Missing } |
1007 | Incomplete Comment | Expected “>” or “*” (lone leading >) |
1008 | Subordination Expected | Line should be subordinated (:) |
1009 | Implicit Variable Call | Expected @ |
1010 | Missing Space | Expected space |
Unexpected Token (11xx)
Code | Name | Info |
---|---|---|
1100 | Unexpected Token | General unexpected token error. |
1101 | Incomplete statement | Improper … |
1102 | Assignment Unexpected | = instead of == (disallow assignment in eval) |
1103 | Wrong Language Error | Trailing ; (we're not in C!); Trailing \ (we're not in Python) |
1104 | Unexpected Subordination | Unexpected subordinator (:) |
Expected Keyword (12xx)
Code | Name | Info |
---|---|---|
1200 | Expected Keyword | General expected keyword error. |
1201 | Type Expected | No type given for MAKE. |
1202 | CASE Expected | No CASE given with SWITCH |
1203 | CATCH Expected | No CATCH given with TRY |
1204 | END Expected | No matching END statement. |
1205 | RETURN Expected | No return in function. |
Unexpected Keyword (13xx)
Code | Name | Info |
---|---|---|
1300 | Unexpected Keyword | General unexpected keyword error. |
1301 | Context Error | META keyword out of context. |
Math and Logic Errors (2xxx)
Math Errors (20xx)
Code | Name | Info |
---|---|---|
2000 | Math Error | General math error. |
2001 | Division Error | Cannot divide by 0. |
2002 | Root Error | Cannot take (even) root of negative number. |
2003 | Log Error | Cannot take log of 0 or negative number. |
2004 | Infinity Error | Solution is infinite. |
2005 | Invalid Operator | Operator invalid.; Operator does not exist. |
2006 | Invalid Operand | Cannot perform math on NaN. |
Non-Decimal Math Error (21xx)
Code | Name | Info |
---|---|---|
2100 | Non-Decimal Math Error | General non-decimal math error. |
2101 | Illegal Digit | Out-of-range digit for base. |
2102 | Invalid Hexadecimal | Decimal point in hexadecimal. |
Loop Errors (22xx)
Code | Name | Info |
---|---|---|
2200 | Infinite Loop Error | Infinite loop. (These should be interrupted when possible.) |
2201 | Missing Iterator Modifier | No increment command in WHILE or DO WHILE. (Infinite loop) |
2202 | Missing Loop Condition | Missing statement in WHILE or DO WHILE. |
2203 | Missing WHILE | No WHILE in DO WHILE. |
2204 | Incomplete FOR | Missing element in FOR header. |
Logic Errors (23xx)
Code | Name | Info |
---|---|---|
2300 | Logic Error | General logic error. |
2322 | Paradox Error | Contradictory statements. (Mainly novelty.) |
Eval Errors (24xx)
Code | Name | Info |
---|---|---|
2400 | Evaluation Error | General eval error. |
2401 | Incomplete Eval | Incomplete eval statement. (Operator leading/trailing) |
2402 | Invalid Type | Invalid type in eval statement. |
2442 | Question Error | Ask a bad question, expect a bad answer. |
System Errors (3xxx)
Code | Name | Info |
---|---|---|
3000 | System Error | General system error. |
3001 | Memory Allocation Error | Cannot allocate memory for variable. |
3002 | Underflow Error | Stack underflow. |
3003 | Overflow Error | Stack overflow. |
3004 | Not Found | File cannot be found. |
3005 | System Access Error | File cannot be accessed.; Process cannot be accessed. |
3006 | Segmentation Fault | Segmentation fault. |
3007 | Unexpected Termination | Process terminated unexpectedly. |
- Last Author
- jcmcdonald
- Last Edited
- Jul 20 2020, 12:11 PM