【发布时间】:2020-08-21 16:34:44
【问题描述】:
我已经搜索了一段时间,我确定我错过了,是否有任何文档说明当值不正确/空白时应该抛出什么?
例如,Python 具有 ValueError,并且文档清楚地说明了何时使用它。
我有以下方法:
proc getJobinfo {question} {
puts -nonewline "$question: "
flush stdout
gets stdin answer
set cleanedanswer [string trim [string totitle $answer]]
if {$cleanedanswer eq ""} {
# What error should be thrown?
}
return $cleanedanswer
}
【问题讨论】:
标签: error-handling try-catch tcl throw