Gracefully handle exceptions when evaluating the function to be learned
Currently any exceptions in the learned function will propagate up and kill the runner because we await function_evaluation
directly.
I could imagine that other behavior could be useful. We could, for example do something like:
try:
y = await function_evaluation
except CancelledError:
raise
except Exception:
y = float('nan')
on the condition that the learner knows how to handle NaN
properly.
OTOH maybe it is the responsibility of the function we are learning to return NaN
if there is a problem (e.g. hitting a band opening when calculating S-matrices).