fork download
  1. class Exception1 extends Exception
  2. class Exception2 extends Exception
  3. class Exception3 extends Exception
  4.  
  5. object Main {
  6. def main(args: Array[String]) {
  7. try {
  8. // jakiś kod
  9. } catch {
  10. case x => {
  11. println("Exception")
  12. val msg = x match {
  13. case _: Exception1 => "1"
  14. case _: Exception2 => "2"
  15. case _: Exception3 => "3"
  16. case _ => "Unknown"
  17. }
  18. println(msg)
  19. }
  20. }
  21. }
  22. }
Success #stdin #stdout 0.03s 246784KB
stdin
1
2
10
42
11
stdout
Standard output is empty