Removed the try and catch block which caused the error.