$ztrap problem

  • robtweed

    robtweed - 2008-04-25

    Here's an odd one that I haven't been able to figure out.  In EWD I need to be able to set an error trap before it dispatches to the page's pre-page script by indirection.  What I do in the main driver is:

    s method=$$getSessionValue("ewd_prePageScript",sessid)
    s x="s error=$$"_method_"(sessid)"
    s $zt="g prePageError^%zewdPHP"
    x x

    The name of the pre-page script function is picked up as a session variable. So far so good, this all works just fine.

    Now I have an example pre-page script in which I'm deliberately forcing an error:

    s ^rob="got here!! $ztrap="_$zt
    s x=yyy ; Error here!!
    QUIT ""

    When I run it, I can see I get into the script and ^rob records $zt correctly as "g prePageError^%zewdPHP"

    However, when the forced error occurs (yyy doesn't exist), it never makes it into prePageError^%zewdPHP - it just collapses in an undignified heap at that point! :-)

    I assume it's something to do with the fact that I'm using indirection to invoke the pre-page script. Also, this stuff is running in a background JOB'd process: not sure if that makes any difference too. Any ideas on what I need to be doing for GT.M to correctly redirect me to the error handler routine?

    The equivalent mechanism works fine in Cache and I'd really like to get the GT.M version to provide the same graceful error trapping mechanism that reports back to the user's browser with the error.

    • Vladimir Ilnitsky

      May be change line

      s $zt="g prePageError^%zewdPHP"


      s $zt="zg "_$zl_":prePageError^%zewdPHP"

      so indirection expression execute on the other level (+1).

    • robtweed

      robtweed - 2008-04-25

      Beautiful! Works like a charm! Many thanks :-)


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks