Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-917

Structured Errors response for passthrough use-cases in NCMP

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Highest Highest
    • Kohn Release
    • None
    • NCMP
    • None

      Current  (original response code and message wrapped as big string)
      http-status: 500
      body: ".... 401 ..... Not found "   

      Wanted: 

      http-status: 500

      body:

      { "dmi-response":
         { "http-code": "401",
           "body": "not found"}
      }

       

      Question Issue: can we use a well defined json object as error response body with 500 response (defined in OpenApi.yaml)

      already defined structure for ALL errors like this:

      {
        "status": "401",
        "message": "some message",
        "details": "{internal json}"
      }

       

      Solution:

      ensure org.onap.cps.ncmp.api.impl.exception.ServerNcmpException#ServerNcmpException (maybe extend?) can store dmi response status and body object as separate  properties (if need create a httpRequestException or similar)

      see org.onap.cps.ncmp.api.impl.NetworkCmProxyDataServiceImpl#handleResponse 

       

      create another method like of org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandler#buildErrorResponse  -> wrapDmiErrorResponse(ServerNcmpException) to return a reponseEntity with code 500 and an error 'string' that is the proposed json above

       

      Consider use HTTP 502:

      "502 Bad GatewayThe server was acting as a gateway or proxy and received an invalid response from the upstream server." so we can have a dedicated format and not mix them up with internal server errors!

       

            mpriyank Priyank Maheshwari
            ToineSiebelink Toine Siebelink
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: