[Fencommits] fenfire-hs: better error message (don't use fromJust in something that can be Nothing!)

Benja Fallenstein benja.fallenstein at gmail.com
Fri Mar 23 16:53:14 EET 2007


Fri Mar 23 16:52:24 EET 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * better error message (don't use fromJust in something that can be Nothing!)
diff -rN -u old-fenfire-hs/Fenfire/RDF.hs new-fenfire-hs/Fenfire/RDF.hs
--- old-fenfire-hs/Fenfire/RDF.hs	2007-03-23 16:53:14.000000000 +0200
+++ new-fenfire-hs/Fenfire/RDF.hs	2007-03-23 16:53:14.000000000 +0200
@@ -330,7 +330,9 @@
     
 graphToRaptor :: Graph -> ([Raptor.Triple], [(String, String)])
 graphToRaptor graph = (map convert triples, namespaces) where
-    graphURI' = fromJust $ Network.URI.parseURI (iriStr $ defaultGraph graph)
+    uri       = iriStr $ defaultGraph graph
+    graphURI' = flip fromMaybe (Network.URI.parseURI uri) $ error $
+                "Fenfire.RDF.graphToRaptor: not a uri: \""++uri++"\""
     convert (s,p,o) = (f s, f p, f o)
     f (IRI s) = Raptor.Uri $ fromMaybe s $ do
                     u <- Network.URI.parseURI s




More information about the Fencommits mailing list