Log before an error is thrown