Skip to content

Commit

Permalink
Item13897: Fixed AccessControlTests
Browse files Browse the repository at this point in the history
Added object attribute on Foswiki::Exception for future use.
  • Loading branch information
vrurg committed Jan 16, 2016
1 parent 35365e3 commit 90965a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 3 additions & 6 deletions UnitTestContrib/lib/Unit/TestRunner.pm
Expand Up @@ -604,10 +604,6 @@ sub runOne {
$tester->set_up($test);

try {
# XXX vrurg Foswiki::Exception has to be replaced with more relevant class
local $SIG{__DIE__} = sub {
Foswiki::Exception->throw( text => $_[0] );
};
$action .=
'$this->{tests_per_module}->{\'' . $suite . '\'}++;';
$tester->$test();
Expand All @@ -622,8 +618,9 @@ sub runOne {
}
}
catch {
my $e = $_;
my $exceptionMessage = $e->stringify;
# If for some reason any code within try just dies then why stringify what's not
# an exception object?
my $exceptionMessage = ref($_) ? $_->stringify : $_;
safe_print "*** ", $exceptionMessage, "\n";
if ( $tester->expecting_failure ) {
$action .=
Expand Down
7 changes: 4 additions & 3 deletions core/lib/Foswiki/Exception.pm
Expand Up @@ -58,10 +58,11 @@ BEGIN {
}
}

has line => ( is => 'rwp' );
has file => ( is => 'rwp' );
has line => ( is => 'rwp', );
has file => ( is => 'rwp', );
has text => ( is => 'ro', );
has stacktrace => ( is => 'rwp' );
has object => ( is => 'ro', );
has stacktrace => ( is => 'rwp', );

sub BUILD {
my $this = shift;
Expand Down

0 comments on commit 90965a8

Please sign in to comment.