loader: identify_file does not print errors
authorJean Privat <jean@pryen.org>
Fri, 5 Dec 2014 03:14:03 +0000 (22:14 -0500)
committerJean Privat <jean@pryen.org>
Sat, 6 Dec 2014 04:25:20 +0000 (23:25 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit

index 9e29a1f..02fc621 100644 (file)
@@ -211,6 +211,8 @@ redef class ModelBuilder
 
        # Identify a source file
        # Load the associated project and groups if required
+       #
+       # Silently return `null` if `path` is not a valid module path.
        private fun identify_file(path: String): nullable ModulePath
        do
                # special case for not a nit file
@@ -230,7 +232,6 @@ redef class ModelBuilder
                        end
 
                        if candidate == null then
-                               toolcontext.error(null, "Error: cannot find module `{path}`.")
                                return null
                        end
                        path = candidate
@@ -370,7 +371,10 @@ redef class ModelBuilder
        do
                # Look for the module
                var file = identify_file(filename)
-               if file == null then return null # forward error
+               if file == null then
+                       toolcontext.error(null, "Error: cannot find module `{filename}`.")
+                       return null
+               end
 
                # Already known and loaded? then return it
                var mmodule = file.mmodule