Skip to content

Commit d40d2a6

Browse files
committed
reformat code
1 parent be16487 commit d40d2a6

File tree

1 file changed

+4
-3
lines changed
  • src/main/scala/org/learningconcurrency/exercises/ch4

1 file changed

+4
-3
lines changed

src/main/scala/org/learningconcurrency/exercises/ch4/ex2.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ object Ex2 extends App {
2828

2929
val p = Promise[T]
3030

31-
def apply(): T = if (p.isCompleted) Await.result(p.future, Duration.Inf)
32-
else throw new Exception("Not contain a value")
31+
def apply(): T =
32+
if (p.isCompleted) Await.result(p.future, Duration.Inf)
33+
else throw new Exception("Not contain a value")
3334

3435
def :=(x: T): Unit = if (!p.tryComplete(Try(x))) throw new Exception("Value is already assigned")
3536
}
@@ -41,7 +42,7 @@ object Ex2 extends App {
4142
try {
4243
v := s"v = ${Thread.currentThread().getName}"
4344
} catch {
44-
case e => log(s"Error !!! ${e.getMessage}. Current value = ${v.apply}")
45+
case e:Throwable => log(s"Error !!! ${e.getMessage}. Current value = ${v.apply}")
4546
}
4647
}
4748
)

0 commit comments

Comments
 (0)