Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-687

ResponseException for TenantAPI, fix wrong postTenant HTTP status code

    XMLWordPrintable

    Details

    • Template:
    • Sprint:
      CP: sprint 94, CP: sprint 95
    • Story Points:
      2
    • Development Team:
      Core: Platform
    • Release:
      Q2 2020 Hot Fix #1

      Description

      Use a ResponseException that contains a javax.ws.rs.core.Response when a TenantAPI call fails.

      The TenantAPI methods use a Handler<AsyncResult<Response>> handler to return success and failure. It is returned as a succeded AsyncResult where the value is the Response:
      https://github.com/folio-org/raml-module-builder/blob/v30.2.4/domain-models-runtime/src/main/java/org/folio/rest/impl/TenantAPI.java

      On success the Response has a 200 or 201 HTTP status code.
      If installation or upgrade fails the Response has a 400 or 500 HTTP status code and a detailed error message in the body.
      Note that AsyncResult is a succeeded result in all cases.

      The documentation was wrong in that it only checked the AsyncResult (succeeded, failed) and not the Response status code. This is fixed by RMB-686.

      This proposal avoids to add the status code check in all RMB based modules:
      A success is returned using a succeeded AsyncResult as before.
      A failure is returned using a failed AsyncResult. A failed AsyncResult doesn't have a value where we can pass the Response. But it has an Exception and we can create our custom ResponseException that contains the Response.

      We need to adjust RestVerticle to extract the Response from the ResponseException.

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                julianladisch Julian Ladisch
                Reporter:
                julianladisch Julian Ladisch
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases