Commit 3f08a66a authored by Max Lv's avatar Max Lv

Merge pull request #574 from JLLK/master

Replace Future.onFailure with Future.onComplete
parents ae0801b7 b76d089f
...@@ -2,12 +2,17 @@ package com.github ...@@ -2,12 +2,17 @@ package com.github
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future import scala.concurrent.Future
import scala.util.{Success, Failure, Try}
/** /**
* @author Mygod * @author Mygod
*/ */
package object shadowsocks { package object shadowsocks {
def ThrowableFuture[T](f: => T) = Future(f) onFailure {
case e: Throwable => e.printStackTrace() val handleFailure: PartialFunction[Try[_], Unit] = {
case Success(_) =>
case Failure(e) => e.printStackTrace()
} }
def ThrowableFuture[T](f: => T) = Future(f) onComplete handleFailure
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment