Commit 2f4cdbce authored by chentao's avatar chentao

Replace Future.onFailure with Future.onComplete

parent 8e2fc2b2
......@@ -2,12 +2,16 @@ package com.github
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.util.{Failure, Try}
/**
* @author Mygod
*/
package object shadowsocks {
def ThrowableFuture[T](f: => T) = Future(f) onFailure {
case e: Throwable => e.printStackTrace()
val handleFailure: PartialFunction[Try[_], Unit] = {
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