#Part 6. Errors
#Part 6 Section 1. Read The First Error
The first error usually names the real problem. Later lines often describe fallout from that first issue. If the message includes a /docs/errors/ URL, open it.
| Error | Meaning | First fix |
|---|---|---|
CB_ERR_ARRAY_INDEX | Code read outside an array | Check the index against len(array) |
CB_ERR_DIVIDE_BY_ZERO | Division used zero | Guard the divisor or use math.divide_or |
CB_ERR_UNKNOWN_FUNCTION | Function is not known | Fix the name or import the right library |
CB_ERR_LICENSE_REQUIRED | Build license is not active | Sign in through Studio Settings |
CB_ERR_PACKAGE_INVALID | Runtime rejected the package | Rebuild from source |
#Part 6 Section 2. Custom Popups
Use CB-Popup for errors a user needs to see.
library CB-Popup
fn main() {
try {
array rows = [10, 20]
println(rows[5])
} catch {
CB-Popup.error("CB_ERR_ARRAY_INDEX", "That row does not exist.")
println(CB-Popup.error_url("CB_ERR_ARRAY_INDEX"))
}
}
Use logs for developer detail. Use popups for clear user action.
