Permalink
Browse files

use G_KEEPERR and CLEAR_ERRSV() to catch errors

  • Loading branch information...
1 parent cad20bf commit 0e90b5fa5ba262ec4278e798f009ee3c09505cc3 @spiritloose committed Oct 16, 2009
Showing with 8 additions and 1 deletion.
  1. +3 −1 mod_psgi.c
  2. +5 −0 t/TestModPSGI.pm
View
@@ -238,11 +238,12 @@ static SV *run_app(request_rec *r, SV *app, SV *env)
XPUSHs(sv_2mortal(env));
PUTBACK;
- count = call_sv(app, G_EVAL|G_SCALAR);
+ count = call_sv(app, G_EVAL|G_SCALAR|G_KEEPERR);
SPAGAIN;
if (SvTRUE(ERRSV)) {
res = NULL;
server_error(r, "%s", SvPV_nolen(ERRSV));
+ CLEAR_ERRSV();
POPs;
} else if (count > 0) {
res = POPs;
@@ -482,6 +483,7 @@ static SV *load_psgi(apr_pool_t *pool, const char *file)
if (SvTRUE(ERRSV)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, "%s", SvPV_nolen(ERRSV));
+ CLEAR_ERRSV();
return NULL;
}
if (!SvOK(app) || !SvROK(app) || SvTYPE(SvRV(app)) != SVt_PVCV) {
View
@@ -14,6 +14,11 @@ our @EXPORT = qw(
run_server_tests
);
+BEGIN {
+ no warnings 'redefine';
+ *Test::Base::run_compare = sub {}; # XXX
+}
+
sub running_in_mod_psgi() {
exists $ENV{MOD_PSGI};
}

0 comments on commit 0e90b5f

Please sign in to comment.