Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TCL捕获忽略错误_Tcl_Catch Block - Fatal编程技术网

TCL捕获忽略错误

TCL捕获忽略错误,tcl,catch-block,Tcl,Catch Block,args是从另一个TCL文件调用的脚本 proc handler { args } { if { [catch {eval $args} errorMessage] } { _report_error "$errorMessage" } } proc是\u阈值\u百分比{thresholdValue}{ #这里有一些代码 如果{[string是双严格的$threshold]&&$threshold

args是从另一个TCL文件调用的脚本

proc handler { args } { 
    if { [catch {eval $args} errorMessage] } {
        _report_error "$errorMessage"
    }
}
proc是\u阈值\u百分比{thresholdValue}{
#这里有一些代码
如果{[string是双严格的$threshold]&&$threshold<0}{
错误“阈值${Threshold}%必须为正。”
}
返回1
}
返回0
}

没有拦网;s正常打印错误,程序带错误退出,但我需要处理错误消息并添加更多详细信息,catch block忽略错误并“正常”完成。

catch经过了非常彻底的测试。它言行一致。我怀疑您给Tcl的指示与您想象的不完全一样;Tcl从不试图猜测你的意思。也许可以创建一个最小的例子来说明你认为哪里出了问题?
proc is_threshold_percent {thresholdValue } {
   #some code here
    if { [ string is double -strict $threshold ] && $threshold < 0 } {
        error "Threshold ${threshold}% must be positive."
    }
    return 1
}
return 0
}