Last active
November 4, 2020 01:34
-
-
Save rupeshtr78/50c8e5731b9cced2a8ff43f09bb1a97e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def catchBlocksPatternMatching(exception: Exception): String = { | |
try { | |
throw exception | |
} catch { | |
case ex: IllegalArgumentException => "It's an IllegalArgumentException" | |
case ex: RuntimeException => "It's a RuntimeException" | |
case _ => "It's an unknown kind of exception" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment