view chapter7/trycatchfinally.scala @ 0:b316eec6fa7a draft default tip

add sample files
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 08 Jan 2013 16:41:46 +0900
parents
children
line wrap: on
line source

import java.net.URL
import java.net.MalformedURLException

def urlFor(path: String) =
    try {
	new URL(path)
    } catch {
	case e: MalformedURLException = >
	new URL("http://www.scala-lang.org")
    }