add Exception and update related code. update test case