It's in a few places, we could refactor it. For now, this should be a `try`/`finally`, though, see the implementation of `f1_score` in the `metrics` module. (If anything below fails, the error settings for the whole process change.)