This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-25
Channels
- # announcements (1)
- # beginners (70)
- # boot (2)
- # cider (12)
- # cljdoc (19)
- # clojure (25)
- # clojure-austin (1)
- # clojure-nl (2)
- # clojure-uk (9)
- # clojurescript (24)
- # cursive (7)
- # datomic (8)
- # figwheel-main (22)
- # flambo (1)
- # fulcro (16)
- # funcool (3)
- # jobs (1)
- # juxt (3)
- # off-topic (39)
- # reagent (4)
- # reitit (4)
- # ring (2)
- # shadow-cljs (90)
- # specter (11)
- # sql (2)
- # testing (2)
import scala.io.Source
def getURLContent(url: String): Try[Iterator[String]] =
for {
url <- parseURL(url)
connection <- Try(url.openConnection())
is <- Try(connection.getInputStream)
source = Source.fromInputStream(is)
} yield source.getLines()
taken from https://danielwestheide.com/blog/2012/12/26/the-neophytes-guide-to-scala-part-6-error-handling-with-try.html to see what it would look like