Use exception type as error code

This pull request adds the explanation for exception type as error code and fix a typo.