Mercurial > urweb
changeset 1773:b5f5e8d439c7
Proper error messages for missing source files
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 26 May 2012 09:16:14 -0400 |
parents | 141f234a91fb |
children | 27fdd78bd2f5 |
files | src/compiler.sml |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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