How can i stop a udf being called if the query is not successful?




I have a simple tick script that calls a udf:

var data = batch
            DO some query

When influxdb is down, the outlier udf raises an internal error and stops agent. Instead of this, i am looking for a way to not call outlier udf unless the data is valid. Can anyone give me a direction how to achieve it?

Thanks a lot