Skip to content

added handling for non-Ok responses from DMS

Rustam Lotsmanenko (EPAM) requested to merge improve-error-response-for-dms into master

Issue: #56

Type of change

  • Bug Fix

Does this introduce a change in the core logic?

  • [NO]

Does this introduce a change in the cloud provider implementation, if so which cloud?

  • Common code

Does this introduce a breaking change?

  • [NO]

What is the current behavior?

Non-ok responses from the DMS service are parsed as OK responses no matter the response code. Example:

{
    "code": 500,
    "reason": "Internal Server Error",
    "message": "Unrecognized field \"code\" (class org.opengroup.osdu.core.common.dms.model.RetrievalInstructionsResponse), not marked as ignorable (one known property: \"datasets\"])_ at [Source: (String)\"{\"code\":401,\"reason\":\"Access denied\",\"message\":\"The user is not authorized to perform this action\"}\"; line: 1, column: 12] (through reference chain: org.opengroup.osdu.core.common.dms.model.RetrievalInstructionsResponse[\"code\"])"
}

Causing confusing error responses from Dataset.

What is the new/expected behavior?

No attempt to parse the error response, instead it will be transferred to the user with additional info that the DMS service failed to respond properly.

{
    "code": 403,
    "reason": "Non-OK response received from DMS service: https://community.gcp.gnrg-osdu.projects.epam.com/api/file/v2/files/storageInstructions",
    "message": "RBAC: access denied"
}

Have you added/updated Unit Tests and Integration Tests?

Yes

Edited by Rustam Lotsmanenko (EPAM)

Merge request reports