Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox committed Aug 22, 2018
1 parent 08fb6fd commit 2ce53f9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ class Database extends ServiceObject {
* transactions within Cloud Spanner, see
* [Transactions](https://cloud.google.com/spanner/docs/transactions) from the
* official Cloud Spanner documentation.
*
*
* If you would like to run a transaction and receive a promise or use
* async/await, use {@link Database#runTransactionAsync}.
*
Expand Down Expand Up @@ -1484,13 +1484,15 @@ class Database extends ServiceObject {
*/
runTransactionAsync(runFn) {
return retry(
this.getTransaction().then(r => {
const transaction = r[0];
return runFn(transaction);
}).catch(e => {
if (e.code === ABORTED) throw e;
throw new retry.AbortError(e.message);
})
this.getTransaction()
.then(r => {
const transaction = r[0];
return runFn(transaction);
})
.catch(e => {
if (e.code === ABORTED) throw e;
throw new retry.AbortError(e.message);
})
);
}
/**
Expand Down

0 comments on commit 2ce53f9

Please sign in to comment.