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:
Xavier Delaruelle
2023-12-19 07:18:02 +01:00
parent b227c5c5bd
commit 76c8ffe82b
3 changed files with 15 additions and 6 deletions

View File

@@ -328,6 +328,7 @@ compopt
config
configs
contrib
conun
cov
cp
cr

View File

@@ -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
}

View File

@@ -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]]
}
}
}