aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-04-21 01:54:22 -0400
committerRalph Amissah <ralph@amissah.com>2012-04-21 01:54:22 -0400
commitd810b3f1a2c26f07cd224cfc23339b5ac0bdd26f (patch)
tree03622443b3c82dd785603d4ff6bd2bb58c83c708
parentv3: sysenv, default processing dir name change (diff)
v3: rescue reportingsisu_3.2.4
-rw-r--r--data/doc/sisu/CHANGELOG_v32
-rw-r--r--lib/sisu/v3/errors.rb23
-rw-r--r--lib/sisu/v3/hub.rb6
-rw-r--r--lib/sisu/v3/screen_text_color.rb2
-rw-r--r--lib/sisu/v3/sysenv.rb25
-rw-r--r--lib/sisu/v3/texinfo.rb5
6 files changed, 46 insertions, 17 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index d641eb10..23b5d927 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.4.orig.tar.xz
* if constants, 'DEVELOPER[:maintenance] == :true' then additionally add
sisu version number to processing directory name
+* v3: rescue reporting
+
%% 3.2.3.orig.tar.xz (2012-04-15:15/7)
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.3
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.3-1
diff --git a/lib/sisu/v3/errors.rb b/lib/sisu/v3/errors.rb
index 25ef688c..f0333334 100644
--- a/lib/sisu/v3/errors.rb
+++ b/lib/sisu/v3/errors.rb
@@ -62,18 +62,23 @@ module SiSU_Errors
class InfoError <CreateFile
def initialize(error,errorlist,cmd,fns='')
@fns,@cmd,@error,@errorlist=fns,cmd,error,errorlist
- @cmd=if cmd and cmd =~/c/; 'Vc'
- else 'V'
- end
+ @cmd=(cmd \
+ && (cmd =~/c/)) \
+ ? 'Vc'
+ : 'V'
end
- def error #creates file errorlog.sisu in pwd of last error reported
- file=if @fns; SiSU_Env::CreateFile.new(@fns).file_error
- else File.new('/tmp/errorlog.sisu','w+')
- end
+ def error
+ file=@fns \
+ ? (SiSU_Env::CreateFile.new(@fns).file_error)
+ : (File.new('/tmp/errorlog.sisu','w+'))
file << @fns << "\n" << @error << "\n" << @errorlist
file.close
- if @cmd=~/[vVM]/; STDERR.puts SiSU_Screen::Ansi.new('',$!,$@).rescue
- else SiSU_Screen::Ansi.new('',"rescued, exception reaised, silenced").puts_grey
+ if @cmd=~/[vVM]/
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ else
+ SiSU_Screen::Ansi.new('',"rescued, exception raised, silenced").puts_grey
end
end
end
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index 7466efde..241d1538 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -675,7 +675,11 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
argv=$*
@opt=SiSU_Commandline::Options.new(argv)
SiSU::Processing.new(@opt).actions
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt,$!,$@,nil).rescue #fix
+ rescue
+ cmd=(@opt ? @opt.cmd : '')
+ SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
Dir.chdir(@@pwd_the)
end
diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb
index c3fd0b29..7705e3b1 100644
--- a/lib/sisu/v3/screen_text_color.rb
+++ b/lib/sisu/v3/screen_text_color.rb
@@ -206,7 +206,7 @@ module SiSU_Screen
def sisu
end
def rescue
- %{\t #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:"#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}}
+ puts %{\t #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}#{yield if block_given?}\n\t An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}}
end
def warn
puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 88ee8ccf..0439955b 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -3442,7 +3442,10 @@ WOK
@env=SiSU_Env::InfoEnv.new(@fns)
m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
@fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@fns,$!,$@).rescue
+ rescue
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
@@ -3905,7 +3908,10 @@ WOK
def initialize(md)
begin
@md=md
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
+ rescue
+ SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
@@ -3933,7 +3939,10 @@ WOK
begin
@md,@fno=md,fno
@env=SiSU_Env::InfoEnv.new(@md.fns)
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
+ rescue
+ SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
@@ -5398,7 +5407,10 @@ WOK
begin
super(fns)
@env=SiSU_Env::InfoEnv.new(fns)
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@fns,$!,$@).rescue
+ rescue
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
@@ -5499,7 +5511,10 @@ WOK
@env_pdf="#{@env_out_root}/pdf"
end
end
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
+ rescue
+ SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end
diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v3/texinfo.rb
index 2496ce7a..d13fb979 100644
--- a/lib/sisu/v3/texinfo.rb
+++ b/lib/sisu/v3/texinfo.rb
@@ -88,7 +88,10 @@ module SiSU_TexInfo
Dir.mkdir(@env.path.output) unless FileTest.directory?("#{@env.path.output}")
Dir.mkdir(@env.processing_path.texi) unless FileTest.directory?(@env.processing_path.texi)
end
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue
+ rescue
+ SiSU_Screen::Ansi.new(opt,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
ensure
end
end