Reference documentation and code samples for the Cloud Spanner API class Google::Cloud::Spanner::Rollback.
Rollback
Used to rollback a transaction without passing on the exception. See
Client#transaction.
Inherits
Google::Cloud::Error
Example
require"google/cloud/spanner"spanner=Google::Cloud::Spanner.newdb=spanner.client"my-instance","my-database"db.transactiondo|tx|tx.update"users",[{id:1,name:"Charlie",active:false}]tx.insert"users",[{id:2,name:"Harvey",active:true}]ifsomething_wrong?# Rollback the transaction without passing on the error# outside of the transaction method.raiseGoogle::Cloud::Spanner::Rollbackendend
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]