changeset 96 | 9fcd3de53c06 |
parent 93 | 4794759139ea |
child 254 | dcd4688690ce |
--- a/progs/app1.scala Tue Sep 24 01:12:36 2013 +0100 +++ b/progs/app1.scala Tue Sep 24 01:56:53 2013 +0100 @@ -1,12 +1,3 @@ -def get_page(url: String) : String = { - try { - Source.fromURL(url).take(10000).mkString - } - catch { - case e => { - println(" Problem with: " + url) - "" - } - } -} - +def get_page(url: String) : String = + Try(Source.fromURL(url).take(10000).mkString) getOrElse + { println(s" Problem with: $url"); ""}