NAME
UpvarExistingOrDie — Do upvar if variable exists, else generate error.
SYNOPSIS
UpvarExistingOrDie VarName Var
DESCRIPTION
Return Value
None (empty string).
Arguments
VarNameName of variable to check for and upvar (same as first argument to upvar).
VarName of variable after upvar (same as second argument to upvar).
More Info
The way upvar works, it will automatically create a variable if it does not exist. If this is not desired, you can use this command to check for an expected variable and if it is not there then generate an error.

For information regarding exceptions / errors, see here.
EXAMPLES

The following code creates a proc that relies on variable existing. When it does not exist, UpvarExistingOrDie will create an error.

proc MyPrintVar {VarName} {
UpvarExistingOrDie $VarName Var
puts "$VarName = $Var"
}
% set abc 123
% MyPrintVar abc
abc = 123
% unset abc
% MyPrintVar abc
Could not find variable abc.
SEE ALSO
UpvarX, VarExistsInCaller
KEYWORDS
check, variable, verification