Change condition on exception class to write to log