Try this!

Using tryCatch to handle errors