Page MenuHomePhabricator

Errors
Updated 755 Days AgoPublic

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)

CodeNameInfo
0000Unknown ErrorWARNING: Don't use me.

Name Errors (00xx)

CodeNameInfo
0001Reserved NameName is reserved keyword.
0002Library Name ConflictName already exists in Ratscript common library.
0003Name ConflictName already exists.
0004Illegal NameCannot give literal as name (3, true, “Bob” vs. Bob)
0005Invalid NameNames may only contain alphanumeric and _.

Type Errors (01xx)

CodeNameInfo
0100Type ErrorMismatched type.
0101Cast ErrorCannot cast.
0102Null ErrorNull passed where value expected. No value defined in variable/constant.

Function Errors (03xx)

CodeNameInfo
0300Function Call ErrorGeneral function call error.
0301Missing ArgumentOne or more arguments are missing.
0302Late Required ArgumentRequired arguments must precede optional arguments.

Access Errors (04xx)

CodeNameInfo
0400Access ErrorGeneral access error.
0401Out of ScopeCannot access variable/function/constant out of scope.
0402(?)
0403Illegal AssignmentAttempting to write to a constant or literal.
0404Reference ErrorVariable/Constant/Function not found.

Syntax Errors (1xxx)

Expected Token (10xx)

CodeNameInfo
1000Expected TokenGeneral expected token error.
1001Opening Bracket ExpectedMissing
1002Closing Bracket ExpectedMissing ]
1003Opening Parenthesis ExpectedMissing (
1004Closing Parenthesis ExpectedMissing )
1005Opening Brace ExpectedMissing {
1006Closing Brace ExpectedMissing }
1007Incomplete CommentExpected “>” or “*” (lone leading >)
1008Subordination ExpectedLine should be subordinated (:)
1009Implicit Variable CallExpected @
1010Missing SpaceExpected space

Unexpected Token (11xx)

CodeNameInfo
1100Unexpected TokenGeneral unexpected token error.
1101Incomplete statementImproper …
1102Assignment Unexpected= instead of == (disallow assignment in eval)
1103Wrong Language ErrorTrailing ; (we're not in C!); Trailing \ (we're not in Python)
1104Unexpected SubordinationUnexpected subordinator (:)

Expected Keyword (12xx)

CodeNameInfo
1200Expected KeywordGeneral expected keyword error.
1201Type ExpectedNo type given for MAKE.
1202CASE ExpectedNo CASE given with SWITCH
1203CATCH ExpectedNo CATCH given with TRY
1204END ExpectedNo matching END statement.
1205RETURN ExpectedNo return in function.

Unexpected Keyword (13xx)

CodeNameInfo
1300Unexpected KeywordGeneral unexpected keyword error.
1301Context ErrorMETA keyword out of context.

Math and Logic Errors (2xxx)

Math Errors (20xx)

CodeNameInfo
2000Math ErrorGeneral math error.
2001Division ErrorCannot divide by 0.
2002Root ErrorCannot take (even) root of negative number.
2003Log ErrorCannot take log of 0 or negative number.
2004Infinity ErrorSolution is infinite.
2005Invalid OperatorOperator invalid.; Operator does not exist.
2006Invalid OperandCannot perform math on NaN.

Non-Decimal Math Error (21xx)

CodeNameInfo
2100Non-Decimal Math ErrorGeneral non-decimal math error.
2101Illegal DigitOut-of-range digit for base.
2102Invalid HexadecimalDecimal point in hexadecimal.

Loop Errors (22xx)

CodeNameInfo
2200Infinite Loop ErrorInfinite loop. (These should be interrupted when possible.)
2201Missing Iterator ModifierNo increment command in WHILE or DO WHILE. (Infinite loop)
2202Missing Loop ConditionMissing statement in WHILE or DO WHILE.
2203Missing WHILENo WHILE in DO WHILE.
2204Incomplete FORMissing element in FOR header.

Logic Errors (23xx)

CodeNameInfo
2300Logic ErrorGeneral logic error.
2322Paradox ErrorContradictory statements. (Mainly novelty.)

Eval Errors (24xx)

CodeNameInfo
2400Evaluation ErrorGeneral eval error.
2401Incomplete EvalIncomplete eval statement. (Operator leading/trailing)
2402Invalid TypeInvalid type in eval statement.
2442Question ErrorAsk a bad question, expect a bad answer.

System Errors (3xxx)

CodeNameInfo
3000System ErrorGeneral system error.
3001Memory Allocation ErrorCannot allocate memory for variable.
3002Underflow ErrorStack underflow.
3003Overflow ErrorStack overflow.
3004Not FoundFile cannot be found.
3005System Access ErrorFile cannot be accessed.; Process cannot be accessed.
3006Segmentation FaultSegmentation fault.
3007Unexpected TerminationProcess terminated unexpectedly.
Last Author
jcmcdonald
Last Edited
Jul 20 2020, 12:11 PM