Guide Index Previous Part Next Part Download Markdown

#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.

ErrorMeaningFirst fix
CB_ERR_ARRAY_INDEXCode read outside an arrayCheck the index against len(array)
CB_ERR_DIVIDE_BY_ZERODivision used zeroGuard the divisor or use math.divide_or
CB_ERR_UNKNOWN_FUNCTIONFunction is not knownFix the name or import the right library
CB_ERR_LICENSE_REQUIREDBuild license is not activeSign in through Studio Settings
CB_ERR_PACKAGE_INVALIDRuntime rejected the packageRebuild 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.