Skip to content
This repository was archived by the owner on Sep 24, 2022. It is now read-only.

Exceptions

Satakun Utama edited this page May 20, 2021 · 1 revision

Currently, There are 6 Exceptions in StoryScript.

  1. InvalidSyntax - Something wrong with the Syntax.
  2. AlreadyDefined - The variable, function, module, or namespace is already defined.
  3. NotImplementedException - The function or module is not implemented.
  4. NotDefinedException - The exception, variable, module, namespace, or function does not exist.
  5. GeneralException - a General Exception. Mostly the Interpreter will never throw this Exception.
  6. DivideByZeroException - Dividing numbers with zero is not allowed.
  7. InvalidValue - The input value is invalid.

Throwing exception

To throw an Exception, You need to follow this format:

throw [Exception] [Description]

The description is optional. Some Exception has a default Description, And some don't. For example:

throw NotImplementedException

Output:

NotImplementedException: This feature is not implemented

Example 2:

throw AlreadyDefined "This value is already defined!"

Output:

AlreadyDefined: This value is already defined!
Clone this wiki locally