dryLang
docsplaygrounddownloadgithub

Getting Started

  • Home
  • Getting Started
  • Setup

Language Basics

  • Variables
  • Types
  • Operators
  • Comments
  • Strings

Control Flow

  • Control Flow
  • Loops

Advanced Concepts

  • Functions
  • Structs
  • Collections
  • Modules
  • HTTP Server
  • Database

Reference

  • Built-ins
  • Error Handling
  • Errors

Examples

  • Hello
  • Variables
  • Functions
  • Control Flow
  • Structs
  • Arrays Maps
  • Try Err
  • Imports
  • Math
  • Strings
  • Http Server
  • Database
  • File Io

Templates

  • Automation
  • Cli Tool
  • Crud
  • Fetch Json
  • File Server
  • Hello
  • Html Render
  • Rest Api
Docs Menu

Getting Started

  • Home
  • Getting Started
  • Setup

Language Basics

  • Variables
  • Types
  • Operators
  • Comments
  • Strings

Control Flow

  • Control Flow
  • Loops

Advanced Concepts

  • Functions
  • Structs
  • Collections
  • Modules
  • HTTP Server
  • Database

Reference

  • Built-ins
  • Error Handling
  • Errors

Examples

  • Hello
  • Variables
  • Functions
  • Control Flow
  • Structs
  • Arrays Maps
  • Try Err
  • Imports
  • Math
  • Strings
  • Http Server
  • Database
  • File Io

Templates

  • Automation
  • Cli Tool
  • Crud
  • Fetch Json
  • File Server
  • Hello
  • Html Render
  • Rest Api

Error Messages

dryLang errors are intentionally minimal. Format:

drylang
line:col message

Compile-Time Errors

These errors occur during parsing or compilation, before the program runs.

ErrorMeaningFix
close }Unmatched closing braceCheck for missing opening {
want }Expected closing braceCheck for missing } at end of block
want )Expected closing parenCheck for missing ) at end of expression
want ]Expected closing bracketCheck for missing ] at end of array
want fnExpected fn after asnasn must be followed by fn
want errExpected err after try blockEvery try {} needs err(e) {}
want IDENTExpected identifierCheck for missing variable or function name
want STRINGExpected string literaluse requires a string argument
illegal XUnexpected tokenCheck syntax around the indicated position
locked XConstant reassignmentCannot reassign a cns or ALL CAPS variable
stray revrev outside functionrev can only be used inside fn blocks
stray donedone outside loopdone can only be used inside lp blocks
stray concon outside loopcon can only be used inside lp blocks
stray awtawt outside async fnawt can only be used inside asn fn blocks
unused XDeclared but never usedRemove or use the variable
bad numberInvalid number literalCheck number format

Runtime Errors

These errors occur during program execution.

ErrorMeaningFix
want numberExpected numeric operandArithmetic ops require numbers
want stringExpected string argumentString functions require strings
want arrayExpected array argumentArray functions require arrays
want mapExpected map argumentMap/dot functions require maps
want fnCalled a non-functionVariable is not a function
want N argsWrong argument countFunction expects N parameters
want array|mapExpected indexable value[] only works on arrays and maps
want string|array|mapExpected lengthed valuelen() requires string, array, or map
div by 0Division by zeroCheck divisor before dividing
bounds NArray index out of rangeIndex N is beyond array length
empty arrayOperation on empty arraypop() on empty array
unknown XUndefined variableVariable X was never assigned
read failFile read errorFile doesn't exist or no permission
write failFile write errorPath invalid or no permission

Reading Error Messages

drylang
3:12 close }
│ │  └── message
│ └── column (character position)
└── line number

Example program with error:

drylang
fn greet(name) {
  pt "Hello, " + name
}

If you add a stray }:

drylang
fn greet(name) {
  pt "Hello, " + name
}
}

Error: 4:1 illegal }

Philosophy

Error messages in dryLang are deliberately short:

  • No suggestions — read the docs
  • No verbose explanations — the error name + position is enough
  • No colors — plain text, pipe-friendly
  • Always includes position — line:col for every error
PreviousError HandlingNextHello