If there are errors while saving data, make sure that as much data as possible is saved and set the error message in "/entry/data_save_error"

r2833 | ffr | 2009-12-03 16:38:55 +1100 (Thu, 03 Dec 2009) | 2 lines
This commit is contained in:
Ferdi Franceschini
2009-12-03 16:38:55 +11:00
committed by Douglas Clowes
parent 746f495d69
commit 64ab146a44

View File

@@ -355,6 +355,7 @@ proc ::nexus::newfile_collection {args} {
debug_msg "save point $point in [dataFileName]"
if [ catch {
set caught_exception false
if {[info level]<2} {
error "ERROR: The [lindex [info level 0] 0] command is for internal use only"
}
@@ -362,13 +363,21 @@ proc ::nexus::newfile_collection {args} {
if {$caller != $valid_caller} {
error "ERROR: [lindex [info level 0] 0] can only be called via the $valid_caller command, not by $caller"
}
foreach child [hlist /] {
} message ] {
set caught_exception true
}
foreach child [hlist /] {
if [ catch {
if {[hpropexists /$child data] && [hgetpropval /$child data] == "true"} {
::nexus::savetree $child $point $filestatus
}
} message ] {
lappend msglst $message
set caught_exception true
}
} message ] {
return -code error "([info level 0]) $message"
}
if {$caught_exception} {
return -code error "([info level 0]) $msglst"
}
}
@@ -458,6 +467,7 @@ proc ::nexus::save {{point 0}} {
::nexus::save_data $point oldfile
}
} message ] {
nxscript puttext data_save_error "([info level 0]) $message"
set caught_exception true
}
if {[info exists data_label] && [info exists currFilename($data_label)]} {
@@ -646,42 +656,48 @@ proc ::nexus::save {{point 0}} {
#
# @param hpath path of subtree to save, must not be "/"
# @param pt Current array index for mutable data (optional default=0)
proc ::nexus::savetree {hpath pt filestatus} {
proc ::nexus::savetree {hpath pt filestatus} {
set caught_exception false
foreach child [hlist /$hpath] {
if [ catch {
foreach child [hlist /$hpath] {
array unset p_arr
array set p_arr [hlistprop /$hpath/$child tcllist]
if {([info exists p_arr(type)] == 0) || ($p_arr(type) != "nxvgroup")} {
set data_type [lindex [split [hinfo /$hpath/$child] , ] 0]
if {[info exists p_arr(data)] && ($p_arr(data) == true) && ($p_arr(nxsave) == true) } {
if {[info exists p_arr(nxalias)]} {
if {[info exists p_arr(savecmd)]} {
if {[info exists p_arr(mutable)] && ($p_arr(mutable) == "true") } {
$p_arr(savecmd) $p_arr(sicsdev) $p_arr(nxalias) /$hpath/$child $data_type $filestatus point $pt
} else {
$p_arr(savecmd) $p_arr(sicsdev) $p_arr(nxalias) /$hpath/$child $data_type $filestatus
}
array unset p_arr
array set p_arr [hlistprop /$hpath/$child tcllist]
if {([info exists p_arr(type)] == 0) || ($p_arr(type) != "nxvgroup")} {
set data_type [lindex [split [hinfo /$hpath/$child] , ] 0]
if {[info exists p_arr(data)] && ($p_arr(data) == true) && ($p_arr(nxsave) == true) } {
if {[info exists p_arr(nxalias)]} {
if {[info exists p_arr(savecmd)]} {
if {[info exists p_arr(mutable)] && ($p_arr(mutable) == "true") } {
$p_arr(savecmd) $p_arr(sicsdev) $p_arr(nxalias) /$hpath/$child $data_type $filestatus point $pt
} else {
if {[info exists p_arr(mutable)] && ($p_arr(mutable) == "true") } {
nxscript puthdb /$hpath/$child point $pt
} else {
nxscript puthdb /$hpath/$child
}
if {$filestatus == "newfile"} {
if {[info exists p_arr(link)] && ($p_arr(link) != "@none")} {
nxscript makelink $p_arr(link) $p_arr(nxalias)
}
$p_arr(savecmd) $p_arr(sicsdev) $p_arr(nxalias) /$hpath/$child $data_type $filestatus
}
} else {
if {[info exists p_arr(mutable)] && ($p_arr(mutable) == "true") } {
nxscript puthdb /$hpath/$child point $pt
} else {
nxscript puthdb /$hpath/$child
}
if {$filestatus == "newfile"} {
if {[info exists p_arr(link)] && ($p_arr(link) != "@none")} {
nxscript makelink $p_arr(link) $p_arr(nxalias)
}
}
}
::nexus::savetree $hpath/$child $pt $filestatus
}
}
::nexus::savetree $hpath/$child $pt $filestatus
}
}
} message ] {
return -code error "([info level 0]) $message"
lappend msglst $message
set caught_exception true
}
}
if {$caught_exception} {
return -code error "([info level 0]) $msglst"
}
}
##
# @brief Recursive portion of gen_nxdict function
@@ -793,6 +809,7 @@ proc ::nexus::gen_nxdict {nexusdic} {
puts $fh pa_hmmdimstr=-1,0
puts $fh pa_hmmrank=1
puts $fh pa_hmmdatname=hmm
puts $fh "data_save_error = /\$(pa_entryName),NXentry/SDS data_save_error -type NX_CHAR"
foreach {n v} [array get nxdictionary] {
puts $fh "$n = $v"
@@ -1320,7 +1337,7 @@ foreach expt $::nexus::exports {
set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}]
set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
set tmpstr [string map {"$" ""} {$Revision: 1.49 $}]
set tmpstr [string map {"$" ""} {$Revision: 1.50 $}]
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
#namespace eval data {