Better handling of arbitrary exceptions with logging