# HG changeset patch # User Adam Chlipala # Date 1338038174 14400 # Node ID b5f5e8d439c779fb6ff33e7db1b6398c85190d6f # Parent 141f234a91fb8666fe8973e5c1a85126e9183d3e Proper error messages for missing source files diff -r 141f234a91fb -r b5f5e8d439c7 src/compiler.sml --- a/src/compiler.sml Sat May 19 12:12:54 2012 -0400 +++ b/src/compiler.sml Sat May 26 09:16:14 2012 -0400 @@ -905,6 +905,8 @@ structure SS = BinarySetFn(SK) structure SM = BinaryMapFn(SK) +exception MissingFile of string + val parse = { func = fn {database, sources = fnames, ffi, onError, ...} : job => let @@ -950,6 +952,11 @@ val ur = OS.Path.joinBaseExt {base = fname, ext = SOME "ur"} val urs = OS.Path.joinBaseExt {base = fname, ext = SOME "urs"} + val () = if Posix.FileSys.access (ur, []) then + () + else + raise MissingFile ur + val sgnO = if Posix.FileSys.access (urs, []) then SOME (Source.SgnConst (#func parseUrs urs), @@ -1062,7 +1069,8 @@ in checkErrors (); d - end + end handle MissingFile fname => (ErrorMsg.error ("Missing source file: " ^ fname); + (Source.DSequence "", ErrorMsg.dummySpan)) val dsFfi = map parseFfi ffi val ds = map parseOne fnames