Skip to reading
Error Handling & Debugging

Catch a failed operation in PCA Script

Edition 0.86.4.4 Hotfix 2

Updated through 0.86.4.4 Hotfix 2, with cinematic property, recorded-pose or voice-timing lessons as described in this guide. Earlier examples, screenshots and complete registry figures retain their stated edition context.

Download PDFView PDF page

LANGUAGE GUIDE · PCA SCRIPT

Use try around the operation that can fail. Catch receives an error record. Keep the block small enough that the message points to one job.

Code example
function run()
    let count = -1
    try
        assert count >= 0
        return "Ready"
    catch problem
        log problem.message
        return "Check the count"
    end
end

In this listing the count is deliberately fixed at −1 so the failure is visible. The assertion fails. The catch block logs Assertion failed. and returns Check the count. A nonnegative count reaches the earlier return.

Source table from Catch a failed operation in PCA Script, page 15
problem.messageA readable description of the failure.
problem.lineThe source line reported for that failure.
problem.scriptIdThe ID of the record that reported the error.

A syntax error prevents this routine from starting. Fix it with Validate. Use catch for a runtime failure reported through the shared script engine. If an operation returns a failure value normally, inspect that value explicitly.

Page 15 of 37Permalink
Go to page