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._
19
19
import scalikejdbc ._
20
20
import scalikejdbc .GlobalSettings ._
21
21
import scala .collection .mutable .LinkedHashMap
22
+ import scala .util .{ Failure , Success }
22
23
import scalikejdbc .async .ShortenedNames ._
23
24
import java .sql .PreparedStatement
24
25
import scalikejdbc .async .internal .MockPreparedStatement
@@ -622,12 +623,13 @@ trait AsyncDBSession extends LogSupport {
622
623
623
624
protected def withListeners [A ](statement : String , parameters : Seq [Any ], startMillis : Long = System .currentTimeMillis)(
624
625
f : Future [A ])(implicit cxt : EC = EC .global): Future [A ] = {
625
- f.onSuccess {
626
- case _ =>
626
+ f.onComplete {
627
+ case Success (_) =>
627
628
val millis = System .currentTimeMillis - startMillis
628
629
GlobalSettings .queryCompletionListener.apply(statement, parameters, millis)
630
+ case Failure (e) =>
631
+ GlobalSettings .queryFailureListener.apply(statement, parameters, e)
629
632
}
630
- f.onFailure { case e : Throwable => GlobalSettings .queryFailureListener.apply(statement, parameters, e) }
631
633
f
632
634
}
633
635
You can’t perform that action at this time.
0 commit comments