Test exception handler