异常中也可以使用case 匹配异常类型

    1. try {
    2. remoteCalculatorService.add(1, 2)
    3. } catch {
    4. case e: ServerIsDownException => log.error(e, "the remote calculator service is unavailable. should have kept your trusty HP.")
    5. } finally {
    6. remoteCalculatorService.close()
    7. }