there were a few errors, use try catch