Handling exceptions (Tcl scripting)

To control the flow of the Designer software based on certain conditions (for example, success or failure of certain commands), you can use the Tcl built-in catch command as follows:

if { [ catch {open_design $des_name.adb} ] } {

    puts "Cannot open $des_name.adb"

    export -format "log" -diagnostic $des_name.log"

   exit 1

    } else {

   puts "Design $des_name.adb Successfully Opened"

}

## set layout mode to standard

layout -incremental "OFF"

if { [ catch {layout} ] } {

    puts "Layout Failed"

    export -format "log" -diagnostic $des_name.log"

    exit 1

} else {

   puts "layout successful"

  export -format log "$des_name.log"

  save_design "$des_name.adb";

  close_design

}