[Dancer-users] status code needs to be an integer greater than or equal to 100...

Richard Huxton dev at archonet.com
Mon Jan 17 21:03:25 CET 2011


On 17/01/11 17:55, Puneet Kishor wrote:
> found the cause, but not the reason. Could someone explain please?
>
> The following works
>
> my $dbh = DBI->connect(
> "dbi:SQLite:dbname=$db","","",
> {RaiseError => 1, AutoCommit => 1}
> ) or die $DBI::errstr;
>
> but the following fails (note AutoCommit => 0)
>
> my $dbh = DBI->connect(
> "dbi:SQLite:dbname=$db","","",
> {RaiseError => 1, AutoCommit => 0}
> ) or die $DBI::errstr;

Here you have at least two options of an error being thrown:
1. RaiseError => 1
2. a "die" if the connect fails.

>> Plack::Middleware::StackTrace::__ANON__('status code needs to be an
>> integer greater than or equal to 100 at

This is complaining that a status-value being returned is invalid. I 
suspect it is something related to an error message being returned.

So - using Try::Tiny wrap your error-causing code:

try {
   my $dbh = ...
}
catch {
   my $err_msg = $_;
   error($err_msg);	# Log the error

   # Redirect to an error page...
   session('error_message', $err_msg);
   redirect('/error');
};

-- 
   Richard Huxton
   Archonet Ltd


More information about the Dancer-users mailing list