Skip to content

Commit

Permalink
use raise() instead of error()
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Simões committed Feb 26, 2013
1 parent 2d4265c commit 73be34a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Changes
Expand Up @@ -2,7 +2,7 @@ Revision history for Dancer-Session-CHI

{{$NEXT}}
- Fixed Dancer import.
- Switched to using &Dancer::error instead of &Carp::croak.
- Switched to using &Dancer::Exception::raise instead of &Carp::croak.
- Promoted to full release.

v0.1.5 2013-02-26 14:38:13 America/Chicago
Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Expand Up @@ -3,7 +3,7 @@ author = Richard Simões <rsimoes AT cpan DOT org>
license = MIT
copyright_holder = Richard Simões
copyright_year = 2013
version = v0.1.5
version = v0.1.6

[@Filter]
-bundle = @Basic
Expand Down
9 changes: 4 additions & 5 deletions lib/Dancer/Session/CHI.pm
Expand Up @@ -6,8 +6,8 @@ use utf8;
use CHI;
use Dancer ":syntax";
use Dancer::Logger;
use Dancer::Config qw(setting);
use Dancer::ModuleLoader;
use Dancer::Exception qw(raise);
use File::Spec::Functions qw(rel2abs);
use Scalar::Util qw(blessed);

Expand Down Expand Up @@ -69,7 +69,7 @@ sub _build_chi {

my $options = setting("session_CHI");
if ( ref($options) ne "HASH" ) {
error "CHI session options not found";
raise core_session => "CHI session options not found";
}

# Don't let CHI determine the absolute path:
Expand All @@ -80,15 +80,14 @@ sub _build_chi {
my $use_plugin = delete $options->{use_plugin};
my $is_loaded = exists setting("plugins")->{"Cache::CHI"};
if ( $use_plugin && !$is_loaded ) {
error "CHI plugin requested but not loaded";
raise core_session => "CHI plugin requested but not loaded";
}

$chi = $use_plugin
? do {
my $plugin = "Dancer::Plugin::Cache::CHI";
my $error_msg = "$plugin is needed and is not installed";
unless ( Dancer::ModuleLoader->load($plugin) ) {
raise( core_session => $error_msg );
raise core_session => "$plugin is needed and is not installed";
}
Dancer::Plugin::Cache::CHI::cache()
}
Expand Down

0 comments on commit 73be34a

Please sign in to comment.