slightly improve error message for unknown module import

This commit is contained in:
Irmen de Jong 2021-10-27 00:38:36 +02:00
parent d4513364fb
commit 3cc7ad7d20
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ private fun compileMain(args: Array<String>): Boolean {
val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watches for file changes), greatly increases compilation speed")
val slowCodegenWarnings by cli.option(ArgType.Boolean, fullName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation")
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler, currently '${C64Target.name}' and '${Cx16Target.name}' available").default(C64Target.name)
val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths to search in for imported modules").multiple().delimiter(File.pathSeparator)
val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator)
val moduleFiles by cli.argument(ArgType.String, fullName = "modules", description = "main module file(s) to compile").multiple(999)
try {

View File

@ -33,7 +33,7 @@ class ModuleImporter(private val program: Program,
val srcPath = when (candidates.size) {
0 -> return Err(NoSuchFileException(
file = filePath.normalize().toFile(),
reason = "searched in $searchIn"))
reason = "Searched in $searchIn"))
1 -> candidates.first()
else -> candidates.first() // when more candiates, pick the one from the first location
}
@ -105,7 +105,7 @@ class ModuleImporter(private val program: Program,
importModule(it)
},
failure = {
errors.err("no module found with name $moduleName", import.position)
errors.err("no module found with name $moduleName. Searched in: $sourcePaths (and internal libraries)", import.position)
return null
}
)