diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-05-26 09:16:14 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-05-26 09:16:14 -0400 |
commit | 0ea6bd1ccba2c945b12199d2b12a9ed3bb565e06 (patch) | |
tree | a064963b2927a7a5305d1895399dd8bb049d54b1 | |
parent | 4755c6ac36cb5c382c37b71e45882ab8cfac7811 (diff) |
Proper error messages for missing source files
-rw-r--r-- | src/compiler.sml | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler.sml b/src/compiler.sml index bd6ef493..477c8fa4 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -905,6 +905,8 @@ end 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 parse = { 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 @@ val parse = { 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 |