status code needs to be an integer greater than or equal to 100...
I am quite frustrated with Dancer's error reporting, perhaps the only part of it that needs improvement, since the rest of Dancer is so wonderful. I am getting the dreaded, "status code needs to be an integer greater than or equal to 100 at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27" message in my browser, all nicely and neatly formatted. I can't for the life of me figure out what is triggering this, so the only recourse I have is to comment my code completely and then uncomment lines one by one. Any suggestions on how I can make this process more scientific and quick? Besides this, the problem is that Dancer seems to report messages in different ways depending on when the error is trapped. Sometimes, I get this nicely formatted message, colors and all, in my browser. Sometimes, I get just a plain text message in my browser. Sometimes, I get the "Internal Server Error" and then I have to pore through the Apache logs. This inconsistency makes for difficulty. Many thanks, -- Puneet Kishor
I ran the program on the command line, and then accessed it via curl, so here is the entire error stream. Quite unhelpful, as it appears to me. The error gets triggered as soon as I do a $sth->execute. Trace begun at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 22 Plack::Middleware::StackTrace::__ANON__('status code needs to be an integer greater than or equal to 100 at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27^J') called at /usr/local/lib/perl5/5.12.1/Carp.pm line 62 Carp::croak('status code needs to be an integer greater than or equal to 100') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/Lint.pm line 103 Plack::Middleware::Lint::validate_res('Plack::Middleware::Lint=HASH(0x100891780)', 'ARRAY(0x10087cc38)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/Lint.pm line 25 Plack::Middleware::Lint::call('Plack::Middleware::Lint=HASH(0x100891780)', 'HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Component.pm line 39 Plack::Component::__ANON__('HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27 Plack::Middleware::StackTrace::__ANON__ at /usr/local/lib/perl5/site_perl/5.12.1/Try/Tiny.pm line 71 eval {...} at /usr/local/lib/perl5/site_perl/5.12.1/Try/Tiny.pm line 67 Try::Tiny::try('CODE(0x100d4f5d8)', 'Try::Tiny::Catch=REF(0x100cbbfb8)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27 Plack::Middleware::StackTrace::call('Plack::Middleware::StackTrace=HASH(0x100d4f458)', 'HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Component.pm line 39 Plack::Component::__ANON__('HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Handler/CGI.pm line 37 Plack::Handler::CGI::run('Plack::Handler::CGI=HASH(0x100cbbe80)', 'CODE(0x100d4f3f8)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Loader.pm line 83 Plack::Loader::run('Plack::Loader=HASH(0x100880e10)', 'Plack::Handler::CGI=HASH(0x100cbbe80)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Runner.pm line 256 Plack::Runner::run('Plack::Runner=HASH(0x10080fe30)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Runner.pm line 231 Plack::Runner::run('Plack::Runner', '/Users/punkish/Sites/humanesettlements/humanesettlements.pl') called at /Users/punkish/Sites/humanesettlements/public/dispatch.cgi line 4 Puneet Kishor wrote:
I am quite frustrated with Dancer's error reporting, perhaps the only part of it that needs improvement, since the rest of Dancer is so wonderful.
I am getting the dreaded, "status code needs to be an integer greater than or equal to 100 at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27" message in my browser, all nicely and neatly formatted. I can't for the life of me figure out what is triggering this, so the only recourse I have is to comment my code completely and then uncomment lines one by one. Any suggestions on how I can make this process more scientific and quick?
Besides this, the problem is that Dancer seems to report messages in different ways depending on when the error is trapped. Sometimes, I get this nicely formatted message, colors and all, in my browser. Sometimes, I get just a plain text message in my browser. Sometimes, I get the "Internal Server Error" and then I have to pore through the Apache logs. This inconsistency makes for difficulty.
Many thanks,
-- Puneet Kishor http://punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Fellow http://creativecommons.org/about/people/fellows#puneetkishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu --------------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ===========================================================================
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; Puneet Kishor wrote:
I ran the program on the command line, and then accessed it via curl, so here is the entire error stream. Quite unhelpful, as it appears to me. The error gets triggered as soon as I do a $sth->execute.
Trace begun at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 22 Plack::Middleware::StackTrace::__ANON__('status code needs to be an integer greater than or equal to 100 at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27^J') called at /usr/local/lib/perl5/5.12.1/Carp.pm line 62 Carp::croak('status code needs to be an integer greater than or equal to 100') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/Lint.pm line 103
Plack::Middleware::Lint::validate_res('Plack::Middleware::Lint=HASH(0x100891780)', 'ARRAY(0x10087cc38)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/Lint.pm line 25
Plack::Middleware::Lint::call('Plack::Middleware::Lint=HASH(0x100891780)', 'HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Component.pm line 39 Plack::Component::__ANON__('HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27 Plack::Middleware::StackTrace::__ANON__ at /usr/local/lib/perl5/site_perl/5.12.1/Try/Tiny.pm line 71 eval {...} at /usr/local/lib/perl5/site_perl/5.12.1/Try/Tiny.pm line 67 Try::Tiny::try('CODE(0x100d4f5d8)', 'Try::Tiny::Catch=REF(0x100cbbfb8)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27
Plack::Middleware::StackTrace::call('Plack::Middleware::StackTrace=HASH(0x100d4f458)', 'HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Component.pm line 39 Plack::Component::__ANON__('HASH(0x100cbbb98)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Handler/CGI.pm line 37
Plack::Handler::CGI::run('Plack::Handler::CGI=HASH(0x100cbbe80)', 'CODE(0x100d4f3f8)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Loader.pm line 83 Plack::Loader::run('Plack::Loader=HASH(0x100880e10)', 'Plack::Handler::CGI=HASH(0x100cbbe80)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Runner.pm line 256 Plack::Runner::run('Plack::Runner=HASH(0x10080fe30)') called at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Runner.pm line 231 Plack::Runner::run('Plack::Runner', '/Users/punkish/Sites/humanesettlements/humanesettlements.pl') called at /Users/punkish/Sites/humanesettlements/public/dispatch.cgi line 4
Puneet Kishor wrote:
I am quite frustrated with Dancer's error reporting, perhaps the only part of it that needs improvement, since the rest of Dancer is so wonderful.
I am getting the dreaded, "status code needs to be an integer greater than or equal to 100 at /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm line 27" message in my browser, all nicely and neatly formatted. I can't for the life of me figure out what is triggering this, so the only recourse I have is to comment my code completely and then uncomment lines one by one. Any suggestions on how I can make this process more scientific and quick?
Besides this, the problem is that Dancer seems to report messages in different ways depending on when the error is trapped. Sometimes, I get this nicely formatted message, colors and all, in my browser. Sometimes, I get just a plain text message in my browser. Sometimes, I get the "Internal Server Error" and then I have to pore through the Apache logs. This inconsistency makes for difficulty.
Many thanks,
-- Puneet Kishor
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
Le 17/01/2011 18:44, Puneet Kishor a écrit :
I ran the program on the command line, and then accessed it via curl, so here is the entire error stream. Quite unhelpful, as it appears to me. The error gets triggered as soon as I do a $sth->execute.
I suggest you run the app either with Plack::Middleware::Debug enabled, or with the standalone server. Then you should have the details regarding the error you get. When you have "nice formated" errors, it's Dancer that speaks to you, when you have "Internal Server Error", it's Plack telling you it catched an error somewhere. Hope that helps.
Alexis Sukrieh wrote:
Le 17/01/2011 18:44, Puneet Kishor a écrit :
I ran the program on the command line, and then accessed it via curl, so here is the entire error stream. Quite unhelpful, as it appears to me. The error gets triggered as soon as I do a $sth->execute.
I suggest you run the app either with Plack::Middleware::Debug enabled, or with the standalone server.
Then you should have the details regarding the error you get.
When you have "nice formated" errors, it's Dancer that speaks to you, when you have "Internal Server Error", it's Plack telling you it catched an error somewhere.
Right, you are correct. However, that doesn't help still. The error report, while nicely formatted, doesn't help at all. Here is another example I ran into yesterday that led to a couple of hours being wasted. I was interpolating a hashes keys into a string. Except, I was calling for a key that didn't exist in the hash, like so (contrived example) -- 'A ' . $h{'size'} . ' string that ' . $h{'resu'} . ' be ' . $h{'cond'} I was assuming that my hash %h was like so %h = ( 'size' => 'long', # or 'short' 'resu' => 'may', # or 'may not' 'cond' => 'corrupted # or 'fine' ); I was wrong. One of the keys, say, 'size' didn't exist in the hash. Well, I kept on getting a very nicely formatted 'status code needs to be an integer greater than or equal to 100...' error in my browser. So, it is not just the consistency of error that is important, it is also the usefulness of the error. That said, I do realize that it is probably very difficult to make consistent and helpful error reporting especially given the variety of development environments. Perhaps, to make it easy then, the development team might make a "strong" recommendation of a development environment in order to make good error reporting possible. Initially (when I first started using Dancer), I used the built in web-server. However, I moved to Apache very quickly, because I thought that perhaps I should develop using the same environment that I will eventually use in production, so I don't have to wrestle with Apache peculiarities later on. However, if I am guaranteed good error reporting with a "standard" development environment, I might want to substitute that for the potential pain of later moving to a different production environment. Many thanks,
Hope that helps. _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
-- Puneet Kishor http://punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Fellow http://creativecommons.org/about/people/fellows#puneetkishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu --------------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ===========================================================================
participants (3)
-
Alexis Sukrieh -
Puneet Kishor -
Richard Huxton