Common errors and how to fix them
The parser encountered something unexpected. Usually a typo or missing punctuation.
ayanmo x = 5
Irosu.fo(x) // Error: expected ';'
ayanmo x = 5;
Irosu.fo(x);
A string literal wasn't closed with a matching quote.
ayanmo msg = "Hello world; // Missing closing quote
ayanmo msg = "Hello world";
You're using a variable that hasn't been declared.
Irosu.fo(count); // Error: count not defined
ayanmo count = 0;
Irosu.fo(count);
You're trying to add incompatible types.
ayanmo result = [1, 2] + 3; // Can't add list and number
// Use Ogunda.push to add to list
ayanmo result = Ogunda.push([1, 2], 3); // [1, 2, 3]
Mathematical division by zero.
ayanmo result = 10 / 0; // Error!
ayanmo divisor = get_divisor();
ti (divisor != 0) {
ayanmo result = 10 / divisor;
} bib?k? {
Irosu.fo("Cannot divide by zero");
}
You're accessing a list index that doesn't exist.
ayanmo items = [1, 2, 3];
ayanmo x = Ogunda.get(items, 10); // Only indices 0-2 exist
ayanmo items = [1, 2, 3];
ti (10 < Ogunda.len(items)) {
ayanmo x = Ogunda.get(items, 10);
} bib?k? {
Irosu.fo("Index out of range");
}
You're calling a method that doesn't exist on the domain.
Irosu.write("hello"); // No such method
Irosu.fo("hello"); // Use correct method name
// Or for files:
Odi.write("file.txt", "hello");
Trying to read a file that doesn't exist.
ayanmo data = Odi.read("missing.txt");
// Check if file exists first
ti (Odi.exists("missing.txt")) {
ayanmo data = Odi.read("missing.txt");
} bib?k? {
Irosu.fo("File not found");
}
An ewo (taboo/assertion) condition was false.
ayanmo age = -5;
ewo age >= 0, "Age cannot be negative"; // PANIC!
// Validate data before asserting
ayanmo age = get_age();
ti (age < 0) {
ayanmo age = 0; // Set default
}
ewo age >= 0, "Age cannot be negative"; // Now safe
Use Okanran (Error Handling domain) for recoverable errors:
// Try an operation that might fail
ayanmo result = Okanran.try(|| {
padap? Odi.read("config.txt");
});
// Check if it's an error
ti (Okanran.is_error(result)) {
Irosu.fo("Could not read config, using defaults");
ayanmo result = default_config();
}
// Or use unwrap_or for default value
ayanmo data = Okanran.unwrap_or(
Okanran.try(|| Odi.read("config.txt")),
"default value"
);