Skip to content

Get 'eventIndex' from 'report' object for interact response errors and warnings#72

Merged
kevinlind merged 3 commits intoadobe:dev-v2.2.0from
kevinlind:eventindex
Jul 14, 2023
Merged

Get 'eventIndex' from 'report' object for interact response errors and warnings#72
kevinlind merged 3 commits intoadobe:dev-v2.2.0from
kevinlind:eventindex

Conversation

@kevinlind
Copy link
Copy Markdown
Contributor

Description

Network responses for interact requests set the 'eventIndex' field under the 'report' object for errors and warnings and not the root error/warning object where Edge is currently looking. This change updates the NetworkResponseHandler to look under the "report" object for the "eventIndex" for errors and warnings. A successful response handle sets the "eventIndex" under the root handle object, so no change to that logic was made.

Below is an example of an interact network response, showing the location of the "eventIndex" in each of the 'handle', 'error', and 'warning' response objects.

{
  "requestId": "72eaa048-207e-4dde-bf16-0cb2b21336d5",
  "handle": [
    {
      "eventIndex": 0,
      "type": "state:store",
      "payload": [ ... ]
    }
  ],
  "errors": [
    {
      "type": "https://ns.adobe.com/aep/errors/EXEG-0201-503",
      "status": 503,
      "title": "The 'com.adobe.experience.platform.ode' service is temporarily unable to serve this request. Please try again later.",
      "report": {
           "eventIndex": 0
       }
    }
  ],
  "warnings": [
    {
      "type": "https://ns.adobe.com/aep/errors/EXEG-0204-200",
      "status": 200,
      "title": "A warning occurred while calling the 'com.adobe.audiencemanager' service for this request.",
      "report": {
        "eventIndex": 0,
        "cause": {
          "message": "Cannot read related customer for device id: ...",
          "code": 202
        }
      }
    }
  ]
}

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@kevinlind kevinlind requested review from addb and emdobrin July 10, 2023 20:10
EdgeJson.Response.EventHandle.REPORT,
null
);
int eventIndex = DataReader.optInt(report, EdgeJson.Response.EventHandle.EVENT_INDEX, 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is safe to pass in a null report map with the optTypedMap API - ref

And I like the swift implementation so much more 🙈

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 13, 2023

Codecov Report

Merging #72 (12a5597) into dev-v2.2.0 (c425bd0) will decrease coverage by 0.00%.
The diff coverage is 84.62%.

@@               Coverage Diff                @@
##             dev-v2.2.0      #72      +/-   ##
================================================
- Coverage         83.63%   83.63%   -0.00%     
- Complexity          377      380       +3     
================================================
  Files                29       29              
  Lines              1570     1582      +12     
  Branches            223      225       +2     
================================================
+ Hits               1313     1323      +10     
- Misses              160      162       +2     
  Partials             97       97              
Flag Coverage Δ
functional-tests 66.18% <84.62%> (+0.13%) ⬆️
unit-tests 79.65% <84.62%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...adobe/marketing/mobile/NetworkResponseHandler.java 82.91% <84.62%> (+0.02%) ⬆️

@kevinlind kevinlind merged commit 64cbb31 into adobe:dev-v2.2.0 Jul 14, 2023
@kevinlind kevinlind deleted the eventindex branch July 14, 2023 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move eventIndex in interact response to event error/warning report object

2 participants