QScriptEngine engine; QScriptValue result = engine.evaluate("1/0"); if (engine.hasUncaughtException()) { qDebug() << "Error:" << result.toString(); }In this example, we create a QScriptEngine instance and try to divide 1 by 0, which results in an exception being thrown. We then use `engine.hasUncaughtException()` to check if an exception has occurred. If it has, we use `qDebug()` to print out an error message along with the exception message. This function belongs to the QtScript package library, which is part of the Qt framework.