Skip to content

fix(crowdnode): unwrap the published error before reading localizedDescription - #913

Merged
romchornyi merged 1 commit into
swift-sdk-integrationfrom
fix/crowdnode-error-optional-unwrap
Aug 3, 2026
Merged

fix(crowdnode): unwrap the published error before reading localizedDescription#913
romchornyi merged 1 commit into
swift-sdk-integrationfrom
fix/crowdnode-error-optional-unwrap

Conversation

@romchornyi

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

swift-sdk-integration does not build. #910 replaced error as! CrowdNode.Error with
error as? CrowdNode.Error ?? .messageStatus(error: error.localizedDescription) at both CrowdNode
error sinks. The force-cast implicitly unwrapped the optional; as? does not, so the fallback's
error.localizedDescription is read off Optional<any Error> — the element type of
@Published var error: Error?:

value of optional type 'Published<(any Error)?>.Publisher.Output' (aka 'Optional<any Error>')
must be unwrapped to refer to member 'localizedDescription' of wrapped base type 'any Error'

It was not caught before merging #910 because the SwiftDashSDK package in ../platform was not
compiling locally at the time, so the app target was never reached — as that PR's test section
recorded. It surfaced as soon as the local sandbox was repaired with pod install (the
post-unlink Podfile.lock had gone out of sync with Pods/).

What was done?

Bind the optional in the existing if at both sites:

  • DashWallet/Sources/UI/CrowdNode/Online/OnlineAccountEmailController.swift:103
  • DashWallet/Sources/UI/CrowdNode/Portal/CrowdNodePortalViewController.swift:188

Behaviour is unchanged — the error is CrowdNode.Error test already excluded nil, so the binding
only makes that explicit to the type checker.

How Has This Been Tested?

xcodebuild -workspace DashWallet.xcworkspace -scheme dashpay -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' ARCHS=arm64 buildBUILD SUCCEEDED.

No behavioural testing: this restores compilation of code whose runtime behaviour #910 already
left unchanged.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

…scription

#910 replaced `error as! CrowdNode.Error` with
`error as? CrowdNode.Error ?? .messageStatus(error: error.localizedDescription)`
at both CrowdNode error sinks. The force-cast implicitly unwrapped the
optional; `as?` does not, so the fallback's `error.localizedDescription` is
read off `Optional<any Error>` — the `@Published var error: Error?` element
type — and does not compile:

    value of optional type 'Published<(any Error)?>.Publisher.Output'
    must be unwrapped to refer to member 'localizedDescription'

Bind the optional in the existing `if` instead. Behaviour is unchanged: the
`error is CrowdNode.Error` test already excluded nil, so the new binding only
makes that explicit to the type checker.

This broke the `dashpay` build on swift-sdk-integration. It was not caught
before merge because the SwiftDashSDK package in ../platform was not compiling
locally at the time, so the app target was never reached — as recorded in
#910's test section.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 74b24aa7-aa84-4a0e-b87b-633b16695d04

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@romchornyi
romchornyi merged commit 5762bce into swift-sdk-integration Aug 3, 2026
2 checks passed
@romchornyi
romchornyi deleted the fix/crowdnode-error-optional-unwrap branch August 3, 2026 19:44
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.

2 participants