Whenever an error during the database session occurs, the Errors collection of the Connection object is where you need to go. It contains a group of Error objects that you can examine in order to understand the error. However, this is not the same as detecting an error -- although closely related. The "count"-property of the Errors collection returns the number of Error objects present, thus you use it best to detect errors.