loader: `load_module` error message distinguish non-existing file from invalid file
authorJean Privat <jean@pryen.org>
Sat, 14 Mar 2015 06:34:20 +0000 (13:34 +0700)
committerJean Privat <jean@pryen.org>
Wed, 18 Mar 2015 03:57:11 +0000 (10:57 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit

index 8b6b56d..3001ac8 100644 (file)
@@ -466,7 +466,11 @@ redef class ModelBuilder
                # Look for the module
                var file = identify_file(filename)
                if file == null then
-                       toolcontext.error(null, "Error: cannot find module `{filename}`.")
+                       if filename.file_exists then
+                               toolcontext.error(null, "Error: `{filename}` is not a Nit source file.")
+                       else
+                               toolcontext.error(null, "Error: cannot find module `{filename}`.")
+                       end
                        return null
                end