created try/catch block of code to handel the exception created