reset: better error messages
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 11 Jan 2010 11:54:49 +0000 (12:54 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 11 Jan 2010 11:58:06 +0000 (12:58 +0100)
Use correct tcl syntax to throw exception.

the syntax is "return -code error" not "return -error"

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/target/startup.tcl

index b597b84d15e7ec575e7e05a33ad08f274ab57a65..d68417e808efd135c5bb4d5d92ba55866effef68 100644 (file)
@@ -41,7 +41,7 @@ proc ocd_process_reset_inner { MODE } {
                set halt 0;
        }
        if { $halt < 0 } {
-               return -error "Invalid mode: $MODE, must be one of: halt, init, or run";
+               return -code error "Invalid mode: $MODE, must be one of: halt, init, or run";
        }
 
        # Target event handlers *might* change which TAPs are enabled
@@ -119,7 +119,7 @@ proc ocd_process_reset_inner { MODE } {
                        set s [$t curstate]
 
                        if { 0 != [string compare $s "halted" ] } {
-                               return -error [format "TARGET: %s - Not halted" $t]
+                               return -code error [format "TARGET: %s - Not halted" $t]
                        }
                }
        }