From 99965a524e09c324e0820990d4332e9d0df94bbd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 12 May 2012 00:42:03 -0400 Subject: v3: rescue & error warnings, more touched --- lib/sisu/v3/composite.rb | 10 ++++++++-- lib/sisu/v3/concordance.rb | 15 ++++++++++++--- lib/sisu/v3/db_drop.rb | 6 +++++- lib/sisu/v3/db_import.rb | 8 ++++++-- lib/sisu/v3/db_select.rb | 5 ++++- lib/sisu/v3/dbi.rb | 4 +++- lib/sisu/v3/dbi_discreet.rb | 10 ++++++++-- lib/sisu/v3/manpage.rb | 5 ++++- lib/sisu/v3/po4a.rb | 5 ++++- lib/sisu/v3/xhtml.rb | 10 ++++++++-- lib/sisu/v3/xml.rb | 10 ++++++++-- lib/sisu/v3/xml_dom.rb | 10 ++++++++-- lib/sisu/v3/xml_fictionbook.rb | 5 ++++- lib/sisu/v3/xml_scaffold.rb | 5 ++++- 14 files changed, 86 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb index ac64b15e..4b70dfe3 100644 --- a/lib/sisu/v3/composite.rb +++ b/lib/sisu/v3/composite.rb @@ -111,7 +111,10 @@ module SiSU_Assemble @fns_array=IO.readlines(@opt.fno,'') assembled=insertions? write(assembled) - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -240,7 +243,10 @@ module SiSU_Assemble @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub @fns_array=IO.readlines(@opt.fns,'') files=insertions? - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index 3d8ab38a..76f79d41 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -95,7 +95,10 @@ module SiSU_Concordance SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ SiSU_Concordance::Source::Words.new(@particulars).songsheet end - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -214,7 +217,10 @@ WOK @alph=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_arrays @alphlst=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_strings @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|[#{@alphlst[:l]}#{@alphlst[:u]}]+|\w+}mi - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end end end def songsheet @@ -222,7 +228,10 @@ WOK FileUtils::mkdir_p(@file.output_path.html_concordance.dir) unless FileTest.directory?(@file.output_path.html_concordance.dir) @file_concordance=File.open(@file.place_file.html_concordance.dir,'w') map_para - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure @file_concordance.close end diff --git a/lib/sisu/v3/db_drop.rb b/lib/sisu/v3/db_drop.rb index 4b9aba7d..42562307 100644 --- a/lib/sisu/v3/db_drop.rb +++ b/lib/sisu/v3/db_drop.rb @@ -104,7 +104,11 @@ module SiSU_DbDrop sdb.create_table.endnotes_plus sdb.create_table.urls sdb_index.create_indexes - rescue; SiSU_Errors::InfoError.new($!,$@,'-D').error; sdb.output_dir? + rescue + SiSU_Errors::InfoError.new($!,$@,'-D').error do + __LINE__.to_s + ':' + __FILE__ + end + sdb.output_dir? end exit else diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index a31a0d2d..e4aa1fa4 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -168,7 +168,9 @@ module SiSU_DbImport puts "Error code: #{e.err}" puts "Error message: #{e.errstr}" puts "Error SQLSTATE: #{e.state}" - SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql" sql=File.new(sqlfn,'w') t_d.each {|i| sql.puts i} @@ -179,7 +181,9 @@ module SiSU_DbImport puts "#{__FILE__}:#{__LINE__}" end rescue - SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql" sql=File.new(sqlfn,'w') t_d.each {|i| sql.puts i} diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb index 2d32310d..b77be351 100644 --- a/lib/sisu/v3/db_select.rb +++ b/lib/sisu/v3/db_select.rb @@ -121,7 +121,10 @@ module SiSU_DbSelect @sdb.create_table.endnotes_plus @sdb.create_table.urls @sdb_index.create_indexes - rescue; SiSU_Errors::InfoError.new($!,$@,'-D').error; @sdb.output_dir? + rescue + SiSU_Errors::InfoError.new($!,$@,'-D').error; @sdb.output_dir? do + __LINE__.to_s + ':' + __FILE__ + end end when /^--createtables?$/ @sdb.output_dir? diff --git a/lib/sisu/v3/dbi.rb b/lib/sisu/v3/dbi.rb index f11d9e81..905ab211 100644 --- a/lib/sisu/v3/dbi.rb +++ b/lib/sisu/v3/dbi.rb @@ -130,7 +130,9 @@ module SiSU_DBI begin SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases rescue - SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error + SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end begin diff --git a/lib/sisu/v3/dbi_discreet.rb b/lib/sisu/v3/dbi_discreet.rb index 8f7f0c53..c808dbcc 100644 --- a/lib/sisu/v3/dbi_discreet.rb +++ b/lib/sisu/v3/dbi_discreet.rb @@ -133,7 +133,11 @@ module SiSU_DBI_Discreet #% database building sdb_import.marshal_load tell=SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{db.sqlite.db} database?") tell.puts_grey if @opt.cmd =~/v/ - rescue; SiSU_Errors::InfoError.new($!,$@,'-d').error; sdb.output_dir? + rescue + SiSU_Errors::InfoError.new($!,$@,'-d').error do + __LINE__.to_s + ':' + __FILE__ + end + sdb.output_dir? end end def read_sqlite @@ -149,7 +153,9 @@ module SiSU_DBI_Discreet #% database building SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/ @db.sqlite_discreet.conn_sqlite3 rescue - SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error + SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index 0571a0e6..76e6721e 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -94,7 +94,10 @@ module SiSU_Manpage @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet SiSU_Env::InfoSkin.new(@md).select #watch - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index adb977c2..aeff7acb 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -152,7 +152,10 @@ module SiSU_Po4a SiSU_Po4a::Source::Scroll.new(fn,@dal_array_lang_src,@dal_array_lang_translation,@@md_src,@@md_trn,wrap_width).songsheet SiSU_Env::InfoSkin.new(md).select #watch end - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index c537275c..ff40f9f1 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -95,7 +95,10 @@ module SiSU_XHTML SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").flow if @opt.cmd =~/[MV]/ end SiSU_XHTML::Source::Songsheet.new(@particulars).song - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -110,7 +113,10 @@ module SiSU_XHTML SiSU_XHTML::Source::Scroll.new(@particulars).songsheet SiSU_XHTML::Source::Tidy.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb index aa75e139..0b2467f2 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v3/xml.rb @@ -93,7 +93,10 @@ module SiSU_XML_SAX SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").flow if @opt.cmd =~/[MV]/ end SiSU_XML_SAX::Source::Songsheet.new(@particulars).song - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure #file closed in songsheet end @@ -109,7 +112,10 @@ module SiSU_XML_SAX SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet SiSU_XML_SAX::Source::Tidy.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb index 6b8c4e5c..7b1b7b72 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v3/xml_dom.rb @@ -91,7 +91,10 @@ module SiSU_XML_DOM SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").flow if @opt.cmd =~/[MV]/ end SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -106,7 +109,10 @@ module SiSU_XML_DOM SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet SiSU_XML_DOM::Source::Tidy.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/xml_fictionbook.rb b/lib/sisu/v3/xml_fictionbook.rb index 8fe1e7c1..3234e146 100644 --- a/lib/sisu/v3/xml_fictionbook.rb +++ b/lib/sisu/v3/xml_fictionbook.rb @@ -76,7 +76,10 @@ module SiSU_XML_Fictionbook @md=SiSU_Param::Parameters.new(@opt).get @dal_array=SiSU_DAL::Source.new(@opt).get SiSU_XML_Fictionbook::Source::Scroll.new(@dal_array,@md).songsheet - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/xml_scaffold.rb b/lib/sisu/v3/xml_scaffold.rb index f43daacf..9232a493 100644 --- a/lib/sisu/v3/xml_scaffold.rb +++ b/lib/sisu/v3/xml_scaffold.rb @@ -73,7 +73,10 @@ module SiSU_XML_Scaffold begin @md,@dal_array=@particulars.md,@particulars.dal_array SiSU_XML_Scaffold::Source::Scroll.new(@dal_array,@md).songsheet - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end -- cgit v1.2.3