Origin wraps every runtime error in a structured, human-readable report that includes the file name, the exact line number where the failure occurred, and a plain-English explanation of what went wrong. This behavior is implemented inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/boblio-max/origin/llms.txt
Use this file to discover all available pages before exploring further.
errors.py and fires automatically whenever an unhandled exception propagates out of a running script. For errors you anticipate, the try/except/else construct lets you handle them gracefully without crashing the program.
try / except / else Syntax
Wrap any statement or block of statements in a try block. If an exception is raised inside the try body, execution jumps to the except block. If no exception occurs, the optional else block runs after the try body completes:
Multiple except Blocks
You can chain more than one except block after a single try. Each except catches any unhandled exception in sequence — the first matching block runs, then control continues after the chain:
except currently catches all exceptions without type filtering. Origin does not yet support typed catches such as except TypeError. All except blocks compile to Python’s bare except Exception:.Runtime Error Format
When an unhandled error reaches the top level, Origin’serrors.py module prints a formatted report to the console. The report includes the file path, the line number, the translated error message, and a snippet of the offending source line with a caret pointer:
Friendly Error Translations
Thetranslate_python_error function in errors.py maps common Python exceptions to plain-English Origin messages:
| Python Exception | Origin Message |
|---|---|
NameError | Unknown Variable — “I don’t recognize '<name>'. Did you forget to define it with 'let'?” |
TypeError (string concat) | Type Mismatch — “You’re trying to add a Number to a Piece of Text. Use 'str()' to convert the number first.” |
TypeError (operand mismatch) | Math Error — “You’re trying to do math with two things that don’t match (like a Number and a List).” |
ZeroDivisionError | Math Error — “You tried to divide by zero! Math doesn’t like that.” |
IndexError | Range Error — “You tried to access an item that doesn’t exist in that List.” |
KeyError | Key Error — “I couldn’t find '<key>' in that Dictionary.” |
| Any other | General Error — the raw Python message is forwarded. |
Raising Exceptions from Inline Python
Theraise keyword is reserved in Origin’s lexer but is not yet handled by the parser as a standalone Origin statement. To raise exceptions from Origin scripts, use a py { } block, which passes raw Python directly to the interpreter:
raise and assert are both reserved keywords in the lexer but are not yet implemented as native Origin statements. Use py { } blocks to access Python’s raise and assert directly until native support is added in a future release.