Update of /cvsroot/http-webtest/HTTP-WebTest-Recorder/lib/HTTP/WebTest
In directory sc8-pr-cvs1:/tmp/cvs-serv11556/lib/HTTP/WebTest
Added Files:
Exceptions.pm
Log Message:
Added
--- NEW FILE: Exceptions.pm ---
package HTTP::WebTest::Exceptions;
use strict;
my %EXC;
BEGIN {
%EXC = ( HTTP::WebTest::Exception =>
{ description =>
'Generic base class for all Investion exceptions' },
HTTP::WebTest::Exception::Redirect =>
{ isa => 'HTTP::WebTest::Exception',
fields => [ 'url' ],
description => 'Redirect message' },
);
}
use Exception::Class %EXC;
{
package HTTP::WebTest::Exception;
# have nice stack trace output
sub as_string {
my $self = shift;
my $str = $self->full_message;
chomp $str;
if(exists $self->{show_trace} ? $self->{show_trace} : $self->Trace) {
$str .= "\n\n\n" . $self->_stack_trace . "\n\n";
}
return $str;
}
sub _stack_trace {
my $self = shift;
my $str = '';
while(my $frame = $self->trace->next_frame) {
next if $frame->subroutine eq 'Exception::Class::Base::throw';
next if $frame->subroutine =~ /^Investop::Exceptions::.*error$/;
my $args = join ', ', map defined $_ ? "'$_'" : 'undef', $frame->args;
$str .= ' [' . $frame->filename . ':' . $frame->line . '] ';
$str .= $frame->subroutine . "($args)\n";
}
return $str;
}
}
1;
|