Layer7 API Management

Expand all | Collapse all

How to use Context Variable of Handle Errors Assertion

Jump to Best Answer
  • 1.  How to use Context Variable of Handle Errors Assertion

    Posted 03-27-2017 04:38 PM

    Based on CA-documentation the exception message will be stored in the variable $<prefix>.message, where <prefix> will be specified in the Handle Errors Assertion properties (by default: try-Catch). But when I try to use this variable later on, for example to write it into a response with ${try-Catch.message}, nothing will be displayed. Also when I run the Debugger for the policy, this variable is not mentioned at all. Do I miss something or what's the issue here?

    Thank you!

     

    Ciao Stefan



  • 2.  Re: How to use Context Variable of Handle Errors Assertion

    Posted 03-28-2017 08:10 AM

    Hi Stefan,

     

    I tried the assertion in my lab. I have not managed to get this working and seeing the same issue as what you have said about not seeing variable in service debugger. In order to further investigate please log an issue with us. 

    Regards,

    Ruchi



  • 3.  Re: How to use Context Variable of Handle Errors Assertion
    Best Answer

    Posted 03-28-2017 06:08 PM

    Hello Stefan,

    I may need more details about your test case.

    As per my understanding, the Handle errors assertion is to catch the uncaught exception (such as those raised by the "Raise Error" assertion, or serious internal errors), if the child assertion is not actually throwing an uncaught exception, but is instead just returning a normal assertion failure status, then the Handle Errors assertion is not relevant here, and you can just use normal policy logic to "handle" this error. In that case, you can view the most recent audit detail message by ${audit.details.last.fullText}

     

    Regards,

    Mark



  • 4.  Re: How to use Context Variable of Handle Errors Assertion

    Posted 03-29-2017 06:41 AM

    Hi Mark,

    thank you for the explanation. Yes I thought I could use this assertion also for normal assertion failure status, like a compare or lookup failure or routing was not successful. Maybe this should be better explained in the documentation.

    Ok, then we will still proceed with the normal policy logic.

    Thank you!

     

    Ciao Stefan