Updated exception handler