Edit

SetErrorHandler (handler)

Sets a handler that will be called instead of throwing a runtime error alert. When an error handler is active, any function that would throw a runtime error will instead return a TypeError error object.

Example: 

On HandleError(e)
    alert("Error number " + GetErrorNumber(e), GetErrorMessage(e))
end

on Load
    SetErrorHandler("HandleError")
    Curl_Exec(NULL)    // generate a runtime error
end