Layer7 API Management

 View Only

Unable to catch OTK SQLException error message

  • 1.  Unable to catch OTK SQLException error message

    Posted Oct 16, 2019 03:06 AM
    Edited by Tattwadarsi Biswal Oct 16, 2019 03:18 AM
    My Requirement: How to catch OOTB related error or exception occurred in auth/oauth/v2/token policy

    e.g. Need to catch below error and display custom message.
    2019-10-16T12:24:19.431+0530 WARNING 542 com.l7tech.external.assertions.jdbcquery.server.ServerJdbcQueryAssertion: 9104: "Perform JDBC Query" assertion failed due to: Could not get JDBC Connection: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

    Observation: I am getting 201 error code inside #OTK Fail with error message for SQLException and unable to get/check the error message.
    Problem: Unable to catch SQLException error message. So unable to display a custom messages.

    Can anyone help me out to handle SQLException error message in custom #OTK Fail with error message policy?

    Gateway version: 9.2
    OTK Version: 4.1

     Screenshot: Don't see how 201 error code added for SQLException, seems below code raising exception
    OOTB Code reference