mirror of
https://github.com/envmodules/modules.git
synced 2026-06-18 00:06:53 +08:00
Add conflict unload failed msg at end of conun unload
Rather reporting conflict unload error message in a global conflict error management in cmdModuleLoad after modulefile evaluation, report such error directly where it occurs in cmdModuleUnload. A more precise error message is obtained as the exact module name, version and variant is reported rather module specification passed to conflict definition. Error message is also reported in the correct event order rather at the end.
This commit is contained in:
@@ -328,6 +328,7 @@ compopt
|
||||
config
|
||||
configs
|
||||
contrib
|
||||
conun
|
||||
cov
|
||||
cp
|
||||
cr
|
||||
|
||||
@@ -102,6 +102,14 @@ proc __reportErrorAndExit {message} {
|
||||
error $message {} MODULES_ERR_RENDERED
|
||||
}
|
||||
|
||||
proc reportErrorOrWarningIfForced {message} {
|
||||
if {[getState force]} {
|
||||
reportWarning $message
|
||||
} else {
|
||||
reportError $message
|
||||
}
|
||||
}
|
||||
|
||||
proc reportInternalBug {message {modfile {}} {title {Module ERROR}}} {
|
||||
reportError [formatInternalBugMsg $message $modfile] 0 $title me
|
||||
}
|
||||
|
||||
@@ -1320,17 +1320,13 @@ proc cmdModuleLoad {context uasked tryload loadany tag_list args} {
|
||||
if {$report_con && [info exists conmsg]} {
|
||||
reportWarning $conmsg
|
||||
}
|
||||
# raise conun-specific msg to top level if attempted
|
||||
if {$retisconun} {
|
||||
reportWarning [getErrConUnMsg $moddecconlist] 1
|
||||
}
|
||||
} elseif {$doescon} {
|
||||
if {$retisconun} {
|
||||
if {[info exists conmsg]} {
|
||||
reportError $conmsg
|
||||
}
|
||||
# raise conun-specific msg to top level if attempted
|
||||
knerror [getErrConUnMsg $moddecconlist]
|
||||
# conun-specific msg has already been reported
|
||||
knerror {}
|
||||
} else {
|
||||
knerror $conmsg
|
||||
}
|
||||
@@ -1823,6 +1819,10 @@ proc cmdModuleUnload {context match auto force onlyureq onlyndep args} {
|
||||
reportError "Unload of switched-off [getModuleDesignation\
|
||||
loaded $modname] failed"
|
||||
}
|
||||
conun {
|
||||
reportErrorOrWarningIfForced [getErrConUnMsg\
|
||||
[getModuleDesignation loaded $modname]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user