Hi Massimo. I got it working now. Thank you for your help,
Brice. On Thu, Oct 17, 2013 at 3:16 AM, Massimo Manghi <massimo.man...@unipr.it>wrote: > On 10/16/2013 04:41 AM, Brice Hamon wrote: > >> Hi guys, >> >> I am looking for info on Rivet's ErrorScript. >> >> I get called when something bad happens, but I would like to get all >> info possible on what caused the issue. >> >> I couldn't find much info in the documentation, so I am wondering if >> anybody can help. >> >> Thank you, >> >> Brice. >> > > Hi Brice > > some Rivet internals in order to bring you to the core of the subject > > The code here below is the key point when executing script in mod_rivet. I > removed some non essential line of code for clarity and added comments that > actually weren't in the original code (and I might put them in there) > > Variable 'outbuf' is a pointer to Tcl_Obj storing the whole script you're > about to run to process your request. This script is the concatenation of > > + BeforeScript > + URL-referenced script > + AfterScript > > > if ( Tcl_EvalObjEx(interp, outbuf, 0) == TCL_ERROR ) { > .... > errorCodeListObj = Tcl_GetVar2Ex (interp, "errorCode", > (char *)NULL, TCL_GLOBAL_ONLY); > ..... > > /* if the error was thrown by Rivet, see if it's abort_page and, > * if so, don't treat it as an error, i.e. don't execute the > * installed error handler or the default one, just check if > * a rivet_abort_script is defined, otherwise the page emits > * as normal > */ > > if (strcmp(Tcl_GetString (errorCodeElementObj),"RIVET") == 0) { > > /* > ...here abort_script is executed and then we > jump away to send headers and flush content > to the client > */ > goto good: > > } > > /* if the error hadn't triggered by abort_page then it's a > * real Tcl error occurring in the script stored in outbuf. > * we are going to treat it as such by executing the > * ErrorScript defined script (or the default handler if > * such script hadn't been set) > */ > > if (conf->rivet_error_script ) { > errscript = conf->rivet_error_script; > } else { > errscript = conf->rivet_default_error_**script; > } > > /* Error handling in case rivet_error_script fails goes here*/ > > good: > > /* headers are sent here and channel is flushed */ > > ... > TclWeb_PrintHeaders(globals->**req); > Tcl_Flush(*(conf->outchannel))**; > > return TCL_OK; > > > } > > -- Massimo >