Run scripts in a try-catch and emit an error if an exception is caught.