From 73be34a34c1c8d4f1bdaab58ccbad4fdc6e7ac78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Sim=C3=B5es?= Date: Tue, 26 Feb 2013 16:23:46 -0600 Subject: [PATCH] use raise() instead of error() --- Changes | 2 +- dist.ini | 2 +- lib/Dancer/Session/CHI.pm | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Changes b/Changes index c5aa5d3..d3d136e 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/dist.ini b/dist.ini index b63bed8..ae1e64e 100644 --- a/dist.ini +++ b/dist.ini @@ -3,7 +3,7 @@ author = Richard Simões license = MIT copyright_holder = Richard Simões copyright_year = 2013 -version = v0.1.5 +version = v0.1.6 [@Filter] -bundle = @Basic diff --git a/lib/Dancer/Session/CHI.pm b/lib/Dancer/Session/CHI.pm index 9d70c47..30931db 100644 --- a/lib/Dancer/Session/CHI.pm +++ b/lib/Dancer/Session/CHI.pm @@ -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); @@ -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: @@ -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() }