File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
core/src/main/scala/scalikejdbc/async Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import scala.concurrent._
1919import scalikejdbc ._
2020import scalikejdbc .GlobalSettings ._
2121import scala .collection .mutable .LinkedHashMap
22+ import scala .util .{ Failure , Success }
2223import scalikejdbc .async .ShortenedNames ._
2324import java .sql .PreparedStatement
2425import scalikejdbc .async .internal .MockPreparedStatement
@@ -622,12 +623,13 @@ trait AsyncDBSession extends LogSupport {
622623
623624 protected def withListeners [A ](statement : String , parameters : Seq [Any ], startMillis : Long = System .currentTimeMillis)(
624625 f : Future [A ])(implicit cxt : EC = EC .global): Future [A ] = {
625- f.onSuccess {
626- case _ =>
626+ f.onComplete {
627+ case Success (_) =>
627628 val millis = System .currentTimeMillis - startMillis
628629 GlobalSettings .queryCompletionListener.apply(statement, parameters, millis)
630+ case Failure (e) =>
631+ GlobalSettings .queryFailureListener.apply(statement, parameters, e)
629632 }
630- f.onFailure { case e : Throwable => GlobalSettings .queryFailureListener.apply(statement, parameters, e) }
631633 f
632634 }
633635
You can’t perform that action at this time.
0 commit comments