deal with exception and how to show error messages