0
proc handler { args } { 
    if { [catch {eval $args} errorMessage] } {
        _report_error "$errorMessage"
    }
}

args is script which has call from another TCL file

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
}

Without catch block it;s normally printed error and program exits with an error, but I need handle the error message and add more details and catch block ignores the error and finishes 'normally' .

timrau
  • 22,578
  • 4
  • 51
  • 64
  • 2
    Catch is very thoroughly tested. It does exactly what it says it does. I would suspect that the you have given instructions to Tcl that are not exactly what you _think_ they are; Tcl never tries to second-guess what you mean. – Donal Fellows May 13 '15 at 12:45
  • 1
    Maybe create a minimal example that shows what you think goes wrong? – Str. May 17 '15 at 18:11

0 Answers0