A simple Scala Try, Success, Failure example (reading a file)
alvinalexander.com › scala › try-success-failureSep 29, 2022 · try, catch, and finally syntax declare a null var before try/catch A simple Scala Try, Success, Failure example (reading a file) By Alvin Alexander. Last updated: September 29, 2022 Sorry, I don’t have much free time these days, so without any discussion, here’s a simple Scala Try, Success, and Failure example:
Why scala Try-match matches Throwable as success
stackoverflow.com › questions › 66420932Feb 11, 2012 · Viewed 176 times 2 Try ( new Throwable )match { case Success (_) => println ("Success") case Failure (exception) => exception.printStackTrace () } This code print "Success" Scala version 2.11.12 scala Share Improve this question Follow asked Mar 1, 2021 at 11:04 Ajit Kamble 153 1 11 Add a comment 1 Answer Sorted by: 10 Because new Throwable