不要怂,就是干,撸起袖子干!

Commit 8aadafaa by Sascha Depold

listen for error events and proxy them to the transaction

1 parent 46ffcec3
Showing with 9 additions and 2 deletions
......@@ -55,7 +55,7 @@ Transaction.prototype.begin = function(callback) {
.getQueryInterface()
.startTransaction(this, {})
.success(callback)
.error(onError.bind(this))
}
Transaction.prototype.setAutocommit = function(callback) {
......@@ -64,6 +64,7 @@ Transaction.prototype.setAutocommit = function(callback) {
.getQueryInterface()
.setAutocommit(this, this.options.autocommit)
.success(callback)
.error(onError.bind(this))
}
Transaction.prototype.setIsolationLevel = function(callback) {
......@@ -72,5 +73,11 @@ Transaction.prototype.setIsolationLevel = function(callback) {
.getQueryInterface()
.setIsolationLevel(this, this.options.isolationLevel)
.success(callback)
.error(function(err) { console.log(err) })
.error(onError.bind(this))
}
// private
var onError = function(err) {
this.emit('error', err)
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!