lib/echi-converter.rb in echi-converter-0.3.2 vs lib/echi-converter.rb in echi-converter-0.3.3
- old
+ new
@@ -150,14 +150,18 @@
fileversion = dump_binary 'int', 4
@log.debug "Version " + fileversion.to_s
if $config["echi_process_log"] == "Y"
#Log the file
- echi_log = EchiLog.new
- echi_log.filename = filename
- echi_log.filenumber = filenumber
- echi_log.version = fileversion
+ begin
+ echi_log = EchiLog.new
+ echi_log.filename = filename
+ echi_log.filenumber = filenumber
+ echi_log.version = fileversion
+ rescue => err
+ @log.info "Error creating ECHI_LOG entry - " + err
+ end
end
#Perform a transaction for each file, including the log table
#in order to commit as one atomic action upon success
EchiRecord.transaction do
@@ -208,13 +212,17 @@
#Move the file to the processed directory
FileUtils.mv(echi_file, @processeddirectory)
if $config["echi_process_log"] == "Y"
#Finish logging the details on the file
- echi_log.records = @record_cnt
- echi_log.processed_at = Time.now
- echi_log.save
+ begin
+ echi_log.records = @record_cnt
+ echi_log.processedat = Time.now
+ echi_log.save
+ rescue => err
+ @log.info "Error inserting ECHI_LOG entry - " + err
+ end
end
return @record_cnt
end
@@ -271,11 +279,11 @@
local_filename = $workingdir + '/../files/to_process/' + file_data[8]
ftp_session.getbinaryfile(file_data[8], local_filename)
if $config["echi_ftp_delete"] == 'Y'
begin
- ftp_session.delete(remote_filename)
+ ftp_session.delete(file_data[8])
rescue => err
@log.fatal err
end
end
file_cnt += 1
@@ -291,14 +299,18 @@
def process_ascii filename
echi_file = $workingdir + "/../files/to_process/" + filename
if $config["echi_process_log"] == "Y"
#Log the file
- echi_log = EchiLog.new
- echi_log.filename = filename
- #echi_log.filenumber = filenumber
- #echi_log.version = fileversion
+ begin
+ echi_log = EchiLog.new
+ echi_log.filename = filename
+ #echi_log.filenumber = filenumber
+ #echi_log.version = fileversion
+ rescue => err
+ @log.info "Error creating ECHI_LOG entry - " + err
+ end
end
#Perform a transaction for each file, including the log table
#in order to commit as one atomic action upon success
EchiRecord.transaction do
@@ -335,13 +347,17 @@
#Move the file to the processed directory
FileUtils.mv(echi_file, @processeddirectory)
if $config["echi_process_log"] == "Y"
#Finish logging the details on the file
- echi_log.records = @record_cnt
- echi_log.processed_at = Time.now
- echi_log.save
+ begin
+ echi_log.records = @record_cnt
+ echi_log.processedat = Time.now
+ echi_log.save
+ rescue => err
+ @log.info "Error inserting ECHI_LOG entry - " + err
+ end
end
return @record_cnt
end
@@ -398,17 +414,21 @@
rescue => err
@log.info "Issue with agname_*.dat filename - " + err
end
if $config["echi_process_log"] == "Y"
#Log the file
- echi_log = EchiLog.new
- echi_log.filename = agname_new_filename
- #echi_log.filenumber = filenumber
- #echi_log.version = fileversion
- #Finish logging the details on the file
- echi_log.records = @record_cnt
- echi_log.processed_at = Time.now
- echi_log.save
+ begin
+ echi_log = EchiLog.new
+ echi_log.filename = agname_new_filename
+ #echi_log.filenumber = filenumber
+ #echi_log.version = fileversion
+ #Finish logging the details on the file
+ echi_log.records = @record_cnt
+ echi_log.processedat = Time.now
+ echi_log.save
+ rescue => err
+ @log.info "Error creating ECHI_LOGS entry - " + err
+ end
end
end
end
require $workingdir + '/echi-converter/version.rb'
\ No newline at end of file