Skip to content

Commit

Permalink
Item14237: Make use of Object exception support
Browse files Browse the repository at this point in the history
Also get rid of extra checks left behind from pre-try{} era.
  • Loading branch information
vrurg committed Nov 12, 2017
1 parent cafa10f commit e2b7108
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions PlainFileStoreContrib/lib/Foswiki/Store/PlainFile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,18 @@ sub query {
Foswiki::load_class($module);
}
catch {
Foswiki::Exception::Fatal->throw(
text => "Bad {Store}{QueryAlgorithm} (set to "
my $e = $_;
$this->Throw(
'Foswiki::Exception::Fatal',
"Bad {Store}{QueryAlgorithm} (set to "
. $module
. "); suggest you run configure and select a different algorithm\n"
. ( ref($_) ? $_->stringify : $_ ) )
if defined $_;
. (
UNIVERSAL::ISA( $_, 'Foswiki::Exception' )
? $e->stringify
: $e
)
);
};
$this->queryObj( $this->create($module) );
}
Expand All @@ -886,12 +892,17 @@ sub query {
}
catch {
my $e = $_;
Foswiki::Exception::Fatal->throw(
text => "Bad {Store}{SearchAlgorithm} (set to "
$this->Throw(
'Foswiki::Exception::Fatal',
"Bad {Store}{SearchAlgorithm} (set to "
. $module
. "); suggest you run configure and select a different algorithm\n"
. ( ref($_) ? $_->stringify : $_ ) )
if defined $_;
. (
UNIVERSAL::ISA( $e, 'Foswiki::Exception' )
? $e->stringify
: $e
)
);
};
$this->searchQueryObj( $this->create($module) );
}
Expand Down Expand Up @@ -1496,13 +1507,13 @@ sub _mkPathTo {
);
};
if ( scalar @{$err} ) {
Foswiki::Exception::Fatal->throw(
text => "PlainFile: failed to create ${path}: $!" );
$this->Throw( 'Foswiki::Exception::Fatal',
"PlainFile: failed to create ${path}: $!" );
}

if ($@) {
Foswiki::Exception::Fatal->throw(
text => "PlainFile: failed to create ${path}: $!" );
$this->Throw( 'Foswiki::Exception::Fatal',
"PlainFile: failed to create ${path}: $!" );
}
}

Expand Down

0 comments on commit e2b7108

Please sign in to comment.