-proc with-file {body} {
- global errorInfo errorCode
- set rc [catch { uplevel 1 $body } result]
- switch -exact $rc {
- 0 {
- # ok
- return $result
- }
- 1 {
- # error
- shownotice red "Error reading logfile $currentfile:\n$emsg"
- catch { close $logfile }
- set logfile {}
- }
- default {
- # 2 - 3 - 4 return, break, continue
- return -code $rc $errorInfo $errorCode $result
- }
- 4 {
- #
- }
-
+proc file-error {emsg} {
+ global logfile
+
+ shownotice red "Error reading logfile $currentfile:\n$emsg"
+ catch { close $logfile }
+ catch { unset logfile }
+}