imroved error message considering exception type.