Return to homepage

DOSATO

Copyright © 2024 Sebastiaan Heins

4.0 Errors 1-10

An error is a problem that occurs when the program is running.
There are two types of errors: syntax errors and runtime errors.
Syntax errors are caught before the code is ran, these can not be catched by the user.
Runtime errors are caught while the code is running, these can be catched by the user.
And uncaught error will cause the program to safely exit.
The exit code then is set to the error code.
In most cases a helpful error message is printed to the console, also showing where the error occured.
When no error occured, the program will always exit with exit code 0.

If the program crashes without printing an error message, it is most likely a bug and should be reported.
If the error location is wrong or the error message is not correct, it is most likely a bug and should be reported.

E1: E_INVALID_NUMBER_LITERAL

If a number literal is invalid, throw this error.
Theres are a few examples of invalid number literals:
- 1.
- 1.0.0

do say (1.) // 1. is an invalid number literal

E2: E_INVALID_CHAR_LITERAL

If a char literal is invalid, throw this error.
Theres are a few examples of invalid char literals:
- 'a
- 'ab'

do say ('Hello') // char literal must only have 1 char

E3: E_UNCLOSED_STRING_LITERAL

If a string literal is not closed, throw this error.
Theres are a few examples of unclosed string literals:
- "Hello
- "Hello\"

do say ("Hello) // string literal must be closed

E4: E_TEMPLATE_RECURSION_LIMIT

If the template recursion limit is reached, throw this error.
The template recursion limit is set to 1000 by default.
This limit can be changed by the user.
Template recursion is the process of putting template strings inside of template strings.

E5: E_EXPECTED_MASTER

A master keyword MUST be at the beginning of each line of code.
do, set, make, define, import, include, return, continue, break, switch, const

say ("Hello") // Error, line doesn't start with a master keyword

E6: E_MISSING_CLOSING_PARENTHESIS

A closing parenthesis ')', '}' or ']' is missing.

do say ("Hello" // Error, missing closing parenthesis

E7: E_MISSING_OPENING_PARENTHESIS

An opening parenthesis '(', '{' or '[' is missing.

E8: E_UNEXPECTED_TOKEN

An unexpected token was found.

E9: E_EXPECTED_IDENTIFIER

An identifier was expected.

define void () {} // expected identifier

E10: E_EXPECTED_TYPE_INDENTIFIER

A type identifier was expected.

make a = 0 // expected type identifier