Improved handling of secondary exceptions in exception handler