From 5af7a5e47fff51efd7602bc0f240e64cd6f33b95 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 6 May 2012 23:48:53 -0400 Subject: v3: rescue & error warnings, some touched --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/dal.rb | 44 ++++++++++++++++++++++++++++-------- lib/sisu/v3/epub.rb | 25 ++++++++++++++++----- lib/sisu/v3/epub_concordance.rb | 15 ++++++++++--- lib/sisu/v3/epub_segments.rb | 5 ++++- lib/sisu/v3/epub_tune.rb | 5 ++++- lib/sisu/v3/errors.rb | 2 +- lib/sisu/v3/html.rb | 23 ++++++++++++++----- lib/sisu/v3/html_scroll.rb | 5 ++++- lib/sisu/v3/html_segments.rb | 5 ++++- lib/sisu/v3/html_tune.rb | 5 ++++- lib/sisu/v3/hub.rb | 24 ++++++++++++-------- lib/sisu/v3/manifest.rb | 10 +++++++-- lib/sisu/v3/odf.rb | 5 ++++- lib/sisu/v3/param.rb | 30 ++++++++++++++++--------- lib/sisu/v3/particulars.rb | 50 ++++++++++++++++++++++++++++++++--------- lib/sisu/v3/qrcode.rb | 10 +++++++-- lib/sisu/v3/texpdf.rb | 20 +++++++++++++---- lib/sisu/v3/urls.rb | 10 +++++++-- 19 files changed, 227 insertions(+), 68 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index f634a54c..c0d54f47 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.7.orig.tar.xz sisu_3.2.7-1.dsc sisu_3.2.7-1.debian.tar.gz +* v3: rescue & error warnings, some touched + %% 3.2.6.orig.tar.xz (2012-05-01:18/2) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.6 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.6-1 diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb index bd8d32dd..89dd8fdb 100644 --- a/lib/sisu/v3/dal.rb +++ b/lib/sisu/v3/dal.rb @@ -117,7 +117,10 @@ module SiSU_DAL ? @fnx : @opt.fns create_dal - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@@fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@@fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure SiSU_DAL::Instantiate.new end @@ -132,8 +135,13 @@ module SiSU_DAL : @opt.fns @@dal_array=[] end - dal=(@@dal_array.empty?) ? read_fnc : @@dal_array.dup - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + dal=(@@dal_array.empty?) \ + ? read_fnc + : @@dal_array.dup + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure SiSU_DAL::Instantiate.new end @@ -149,7 +157,10 @@ module SiSU_DAL @@idx_arr[:sst]=[] end dal=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check - 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 SiSU_DAL::Instantiate.new end @@ -165,7 +176,10 @@ module SiSU_DAL @@idx_arr[:tex]=[] end dal=(@@idx_arr[:tex].empty?) ? read_idx_tex : @@idx_arr[:tex].dup #check - 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 SiSU_DAL::Instantiate.new end @@ -181,7 +195,10 @@ module SiSU_DAL @@idx_arr[:html]=[] end dal=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup - 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 SiSU_DAL::Instantiate.new end @@ -197,7 +214,10 @@ module SiSU_DAL @@idx_arr[:xthml]=[] end dal=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup - 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 SiSU_DAL::Instantiate.new end @@ -213,7 +233,10 @@ module SiSU_DAL @@map_arr[:nametags]=[] end dal=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup - 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 SiSU_DAL::Instantiate.new end @@ -229,7 +252,10 @@ module SiSU_DAL @@map_arr[:ocn_htmlseg]=[] end dal=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup - 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 SiSU_DAL::Instantiate.new end diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index e9aeb4de..e19f0e33 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -107,7 +107,10 @@ module SiSU_EPUB scr_toc=SiSU_EPUB::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch SiSU_EPUB::Source::Seg.new(@md,data).songsheet SiSU_EPUB::Source::Output.new(@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 unless @opt.cmd =~/[MV]/ #check maintenance flag texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"] @@ -302,7 +305,10 @@ module SiSU_EPUB begin @@toc[:seg] << toc[:seg] @@toc[:scr] << toc[:seg] - 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 end @@ -603,7 +609,10 @@ module SiSU_EPUB end end out.close - 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 epub_metadata_opf @@ -615,7 +624,10 @@ module SiSU_EPUB end end out.close - 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 images @@ -660,7 +672,10 @@ module SiSU_EPUB end filename_html_index.close 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 end end end diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index e2e5bb5c..b6a20d00 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -85,7 +85,10 @@ module SiSU_EPUB_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_EPUB_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 @@ -167,7 +170,10 @@ WOK @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!! @rgx_splitlist=%r{[—.,;:-]+|#{Mx[:nbsp]}+}mi @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|#{Mx[:url_o]}https?://\S+?#{Mx[:url_c]}|file://\S+|<\S+?>|\w+|[a-zA-Z]+}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 @@ -178,7 +184,10 @@ WOK p "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'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/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 262fde3c..2fba6765 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -140,7 +140,10 @@ WOK data=articles(data) SiSU_EPUB_Seg::Seg.new.cleanup # (((( added )))) #### (((( 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 @@seg_name=[] end diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb index 34466926..b7153192 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v3/epub_tune.rb @@ -216,7 +216,10 @@ module SiSU_EPUB_Tune SiSU_EPUB_Tune::Output.new(data,@md).marshal end tuned=SiSU_EPUB_Tune::Tune.new(@data,@md).output - 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/errors.rb b/lib/sisu/v3/errors.rb index f0333334..4b7c6d30 100644 --- a/lib/sisu/v3/errors.rb +++ b/lib/sisu/v3/errors.rb @@ -75,7 +75,7 @@ module SiSU_Errors file.close if @cmd=~/[vVM]/ SiSU_Screen::Ansi.new('',$!,$@).rescue do - __LINE__.to_s + ':' + __FILE__ + (block_given?) ? yield : __LINE__.to_s + ':' + __FILE__ end else SiSU_Screen::Ansi.new('',"rescued, exception raised, silenced").puts_grey diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index fee51f2c..937ae0d0 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -109,7 +109,10 @@ module SiSU_HTML scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish SiSU_HTML::Source::Output.new(scroll,@md).scroll - 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 unless @opt.cmd =~/[MV]/ #check maintenance flag texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"] @@ -257,7 +260,10 @@ module SiSU_HTML @@toc[:seg] << toc[:seg] if toc[:seg] @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] @@toc[:scr] << toc[:scr] if toc[:scr] - 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 end @@ -626,8 +632,12 @@ WOK @filename_html_scroll.puts para,"\n" end end - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error - ensure; @filename_html_scroll.close + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end + ensure + @filename_html_scroll.close end end def segtoc @@ -642,7 +652,10 @@ WOK @filename_html_segtoc.puts para,"\n" end 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 @filename_html_segtoc.close pwd_set=Dir.pwd diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb index a4d2089e..c0c01784 100644 --- a/lib/sisu/v3/html_scroll.rb +++ b/lib/sisu/v3/html_scroll.rb @@ -71,7 +71,10 @@ module SiSU_HTML_Scroll scr=SiSU_HTML_Scroll::Scroll.new(@md,@data,@endnotes).markup scr[:tails]=SiSU_HTML_Scroll::Scroll.new(@md).tails scr - 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/html_segments.rb b/lib/sisu/v3/html_segments.rb index b1dbf73f..ca2f318d 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -172,7 +172,10 @@ module SiSU_HTML_Seg data=articles(data) SiSU_HTML_Seg::Seg.new.cleanup # (((( added )))) #### (((( 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 @@seg_name=[] end diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v3/html_tune.rb index e4ac08ee..3cc41c33 100644 --- a/lib/sisu/v3/html_tune.rb +++ b/lib/sisu/v3/html_tune.rb @@ -215,7 +215,10 @@ module SiSU_HTML_Tune SiSU_HTML_Tune::Output.new(@data,@md).marshal end tuned=SiSU_HTML_Tune::Tune.new(@data,@md).output - 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/hub.rb b/lib/sisu/v3/hub.rb index ce8446e5..34e6e69f 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -272,22 +272,22 @@ module SiSU @@n_do=0 end def remote_put_base_site_rsync # -CR -p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base end def remote_put_base_site_rsync_match # -CCRZ -p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base_sync end def remote_put_base_site # -Cr -p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base end def remote_put_base_site_all # -CCr -p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base_all end @@ -469,7 +469,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ SiSU_Remote::Get.new(@opt,@get_p).sisupod end rescue - SiSU_Errors::InfoError.new($!,$@,@opt,@fns).error #ok + SiSU_Errors::InfoError.new($!,$@,@opt,@fns).error do + __LINE__.to_s + ':' + __FILE__ + end @retry_count +=1 retry unless @retry_count > 1 ensure @@ -673,7 +675,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.mod.inspect =~/--about/ \ and not @opt.what.empty? SiSU_Help::Help.new(@opt.what,'color_off').help_request - else SiSU_Help::Help.new('list','color_off').help_request + else + SiSU_Help::Help.new('list','color_off').help_request end elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps require_relative 'sitemaps' # sitemaps.rb @@ -687,9 +690,12 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.mod.inspect =~/--help/ \ and not @opt.what.empty? SiSU_Help::Help.new(@opt.what).help_request - elsif @opt.mod.inspect =~/--help/; SiSU_Help::Help.new('list').help_request - else SiSU_Help::Help.new('env',@opt).sisu_version - tell=SiSU_Screen::Ansi.new(''," for HELP type:\n\tsisu --help [help request]\n\tman sisu\n or see the system or online documentation on SiSU:\n #{Config::CONFIG['datadir']}/doc/sisu/\n \n "); tell.puts_grey + elsif @opt.mod.inspect =~/--help/ + SiSU_Help::Help.new('list').help_request + else + SiSU_Help::Help.new('env',@opt).sisu_version + tell=SiSU_Screen::Ansi.new(''," for HELP type:\n\tsisu --help [help request]\n\tman sisu\n or see the system or online documentation on SiSU:\n #{Config::CONFIG['datadir']}/doc/sisu/\n \n ") + tell.puts_grey end end end diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 0eb580b3..ffb540e3 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -93,7 +93,10 @@ module SiSU_Manifest end data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions SiSU_Manifest::Source::Output.new(@md).check_output(data) - 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 @@ -890,7 +893,10 @@ WOK WOK output - 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/odf.rb b/lib/sisu/v3/odf.rb index 68aa6e40..6a6da8b9 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -90,7 +90,10 @@ module SiSU_ODF end SiSU_ODF::Source::Scroll.new(@particulars).songsheet SiSU_Env::InfoSkin.new(@md).select - 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/param.rb b/lib/sisu/v3/param.rb index 60f5345b..20f3b2b9 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -1071,7 +1071,10 @@ module SiSU_Param @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg begin - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -1609,18 +1612,25 @@ module SiSU_Param private class Store def initialize(md,env) - @md=md - @pstorefile="#{env.processing_path.dal}/#{md.fns}.pstore" + @md,@env=md,env end def store - File.unlink(@pstorefile) if FileTest.file?(@pstorefile) - SiSU_Screen::Ansi.new(@md.opt.cmd,"PStore -> #{@pstorefile}").txt_grey if @md.opt.cmd =~/[MV]/ - store=PStore.new(@pstorefile) - store.transaction do - store['md']=@md - store.commit + begin + pstorefile="#{@env.processing_path.dal}/#{@md.fns}.pstore" + File.unlink(pstorefile) if FileTest.file?(pstorefile) + SiSU_Screen::Ansi.new(@md.opt.cmd,"PStore -> #{pstorefile}").txt_grey if @md.opt.cmd =~/[MV]/ + store=PStore.new(pstorefile) + store.transaction do + store['md']=@md + store.commit + end + @@md=@md=nil + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end + ensure end - @@md=@md=nil end end end diff --git a/lib/sisu/v3/particulars.rb b/lib/sisu/v3/particulars.rb index 7c599624..e183d4c8 100644 --- a/lib/sisu/v3/particulars.rb +++ b/lib/sisu/v3/particulars.rb @@ -132,7 +132,10 @@ module SiSU_Particulars begin @md=SiSU_Param::Parameters.new(@opt).get self - 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 end end attr_accessor :opt,:env,:file @@ -140,7 +143,10 @@ module SiSU_Particulars begin @env=SiSU_Env::InfoEnv.new(@opt.fns) self - 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 end end def set_file @@ -148,7 +154,10 @@ module SiSU_Particulars set_md unless @md @file=SiSU_Env::FileOp.new(@md) self - 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 end end attr_accessor :opt,:dal_array @@ -156,35 +165,50 @@ module SiSU_Particulars begin @dal_array=@dal_array=SiSU_DAL::Source.new(@md).get self - 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 end end def set_sst_idx begin @sst_idx=SiSU_DAL::Source.new(@md).get_idx_sst self - 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 end end def set_tex_idx begin @tex_idx=SiSU_DAL::Source.new(@md).get_idx_tex self - 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 end end def set_html_idx begin @html_idx=SiSU_DAL::Source.new(@md).get_idx_html self - 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 end end def set_xhtml_idx begin @xhtml_idx=SiSU_DAL::Source.new(@md).get_idx_xhtml self - 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 end end attr_accessor :nametags_map @@ -193,7 +217,10 @@ module SiSU_Particulars opt=@md ? @md : @opt @nametags_map=SiSU_DAL::Source.new(opt).get_map_nametags self - 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 end end attr_accessor :ocn_htmlseg_map @@ -201,7 +228,10 @@ module SiSU_Particulars begin @ocn_htmlseg_map=SiSU_DAL::Source.new(@md).get_map_ocn_htmlseg self - 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 end end end diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index d2b16753..b84551f2 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -90,7 +90,10 @@ module SiSU_QRcode end data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions OutputInfo.new(@md).check_output(data) - 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 @@ -728,7 +731,10 @@ WOK language_versions output_metadata output_metadata_short - 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/texpdf.rb b/lib/sisu/v3/texpdf.rb index f0fb6b99..eb3b1b44 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -94,7 +94,10 @@ module SiSU_TeX SiSU_Env::FileOp.new(@md).mkdir Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex) 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 @@ -121,7 +124,10 @@ module SiSU_TeX pwd=Dir.pwd SiSU_TeX::Source::LaTeXtoPdf.new(@md,@particulars.env).latexrun_selective Dir.chdir(pwd) - 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 unless @opt.cmd =~/[MV]/ #check maintenance flag texfiles=Dir["#{@env.processing_path.tex}/#{@opt.fns}*"] @@ -261,7 +267,10 @@ module SiSU_TeX end lst=Dir["*.{aux,log,out}"] lst.each {|file| File.unlink(file)} if lst - 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 end @@ -322,7 +331,10 @@ module SiSU_TeX data=number_paras(data) data=markup(data) output(data) - 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/urls.rb b/lib/sisu/v3/urls.rb index ddb62fa7..78650a42 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -69,7 +69,10 @@ module SiSU_Urls def read begin SiSU_Urls::OutputUrls.new(@opt).songsheet if @opt.fnb - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -123,7 +126,10 @@ module SiSU_Urls def songsheet begin @opt.cmd=~/U/ ? urls_all : (urls_select unless @opt.cmd=~/q/) - 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