[Rt-commit] r5940 - in rt/branches/3.7-EXPERIMENTAL: .
lib/RT/Shredder
ruz at bestpractical.com
ruz at bestpractical.com
Fri Sep 15 12:36:17 EDT 2006
Author: ruz
Date: Fri Sep 15 12:36:16 2006
New Revision: 5940
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm
rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder/Exceptions.pm
Log:
r3742 at cubic-pc: cubic | 2006-09-15 19:44:54 +0400
::Shredder
* add ability to throw an Info exception with additional info
Exception::Info->trow('Tag'); or Exception::Info->trow(tag => 'Tag', error => 'additional');
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm Fri Sep 15 12:36:16 2006
@@ -395,8 +395,10 @@
);
unless( @resolvers ) {
- warn "Couldn't find resolver for dependency '". $dep->AsString ."'";
- RT::Shredder::Exception::Info->throw('NoResolver');
+ RT::Shredder::Exception::Info->throw(
+ tag => 'NoResolver',
+ error => "Couldn't find resolver for dependency '". $dep->AsString ."'",
+ );
}
$_->(
Shredder => $self,
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder/Exceptions.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder/Exceptions.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder/Exceptions.pm Fri Sep 15 12:36:16 2006
@@ -44,9 +44,19 @@
END
);
+sub Fields { return ((shift)->SUPER::Fields(@_), 'tag') }
+
+sub tag { return (shift)->{'tag'} }
+
sub full_message {
my $self = shift;
my $error = $self->message;
+ if ( my $tag = $self->tag ) {
+ my $message = $DESCRIPTION{ $self->tag } || '';
+ warn "Tag '$tag' doesn't exist" unless $message;
+ $message .= "\nAdditional info:\n$error" if $error;
+ return $message;
+ }
return $DESCRIPTION{$error} || $error;
}
More information about the Rt-commit
mailing list