Skip to content

Improve AEPOptimizeError Swift/Objective-C interoperability#152

Merged
akhiljain1907 merged 5 commits intoadobe:dev-v5.6.1from
akhiljain1907:fix/AEPOptimizeError
Jul 30, 2025
Merged

Improve AEPOptimizeError Swift/Objective-C interoperability#152
akhiljain1907 merged 5 commits intoadobe:dev-v5.6.1from
akhiljain1907:fix/AEPOptimizeError

Conversation

@akhiljain1907
Copy link
Copy Markdown
Contributor

@akhiljain1907 akhiljain1907 commented Jul 29, 2025

Description

Fixed AEPOptimizeError bridging to ensure proper error handling in both Swift and Objective-C applications.

Problem

  • Objective-C code could not properly detect AEPOptimizeError instances using [error isKindOfClass:[AEPOptimizeError class]] as it is converted into a NSError.
  • SwiftUI error handling failed when casting error as? AEPOptimizeError when error is sent as NSError
  • Error details were not accessible in Objective-C completion handlers

Solution

  • Implemented CustomNSError protocol for AEPOptimizeError to provide proper NSError bridging
  • Added errorDomain, errorCode, and errorUserInfo properties for Objective-C compatibility
  • Maintained backward compatibility with existing Error protocol conformance

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.

…ls in userInfo field to get error details, title, status, report and additional data on Objective-C.
@akhiljain1907 akhiljain1907 changed the title Added asNSError function in AEPOptimize error to return it as a NSError with details in userInfo field. Improve AEPOptimizeError Swift/Objective-C interoperability Jul 29, 2025
@akhiljain1907 akhiljain1907 changed the base branch from main to dev-v5.6.1 July 30, 2025 11:22
@akhiljain1907 akhiljain1907 merged commit ebac7c7 into adobe:dev-v5.6.1 Jul 30, 2025
6 checks passed
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.

3 participants