add try catch for using connection.options