Author: jhorwitz
Date: Sun Dec 9 11:21:08 2007
New Revision: 265
Modified:
mod_parrot/trunk/lib/ModParrot/HLL/nqp.pir
mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir
Log:
add exception handlers for compiler and runtime errors
Modified: mod_parrot/trunk/lib/ModParrot/HLL/nqp.pir
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/HLL/nqp.pir (original)
+++ mod_parrot/trunk/lib/ModParrot/HLL/nqp.pir Sun Dec 9 11:21:08 2007
@@ -18,7 +18,7 @@
# XXX should we replace this with .HLL?
.sub __onload :anon :load
- load_bytecode 'nqp.pbc'
+ load_bytecode 'compilers/nqp/nqp.pbc'
.end
.sub _load
@@ -60,6 +60,9 @@
.local int status
.local int registry
+ # get apache constants
+ ap_const = get_root_global [ 'Apache'; 'Constants' ], 'ap_constants'
+
# get the request_rec object
$P0 = get_class [ 'Apache'; 'RequestRec' ]
r = new $P0
@@ -85,20 +88,34 @@
unless_null handler, RUN_HANDLER
LOAD_HANDLER:
- $P0 = _load(handler_path)
+ push_eh REPORT_ERROR
+ $P0 = _load(handler_path)
+ pop_eh
handler = get_hll_global handler_sub
RUN_HANDLER:
# set default content type
r.'content_type'("text/html")
# run the handler, passing in Apache::RequestRec object
- status = handler(r)
+ push_eh REPORT_ERROR
+ status = handler(r)
+ pop_eh
if registry == 0 goto RETURN_STATUS
$S0 = read pio, 1024
$S1 = pop pio
r.'puts'($S0)
status = 0
+ goto RETURN_STATUS
+
+REPORT_ERROR:
+ get_results '0,0', $P0, $S0
+ $S1 = handler_path
+ concat $S1, ": "
+ concat $S1, $S0
+ $I0 = ap_const['APLOG_ERR']
+ r.'log_rerror'(handler_path, 0, $I0, $S1)
+ status = ap_const['HTTP_INTERNAL_SERVER_ERROR']
RETURN_STATUS:
# return status code
Modified: mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir (original)
+++ mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir Sun Dec 9 11:21:08 2007
@@ -60,6 +60,9 @@
.local int status
.local int registry
+ # get apache constants
+ ap_const = get_root_global [ 'Apache'; 'Constants' ], 'ap_constants'
+
# get the request_rec object
$P0 = get_class [ 'Apache'; 'RequestRec' ]
r = new $P0
@@ -85,20 +88,34 @@
unless_null handler, RUN_HANDLER
LOAD_HANDLER:
- $P0 = _load(handler_path)
+ push_eh REPORT_ERROR
+ $P0 = _load(handler_path)
+ pop_eh
handler = get_hll_global handler_sub
RUN_HANDLER:
# set default content type
r.'content_type'("text/html")
# run the handler, passing in Apache::RequestRec object
- status = handler(r)
+ push_eh REPORT_ERROR
+ status = handler(r)
+ pop_eh
if registry == 0 goto RETURN_STATUS
$S0 = read pio, 1024
$S1 = pop pio
r.'puts'($S0)
status = 0
+ goto RETURN_STATUS
+
+REPORT_ERROR:
+ get_results '0,0', $P0, $S0
+ $S1 = handler_path
+ concat $S1, ": "
+ concat $S1, $S0
+ $I0 = ap_const['APLOG_ERR']
+ r.'log_rerror'(handler_path, 0, $I0, $S1)
+ status = ap_const['HTTP_INTERNAL_SERVER_ERROR']
RETURN_STATUS:
# return status code
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.