Skip to content

feat!: Add exception to onVerificationFailed callback#20

Open
flxapps wants to merge 11 commits intodevfrom
feat/add-exception-to-verification-failed-callback
Open

feat!: Add exception to onVerificationFailed callback#20
flxapps wants to merge 11 commits intodevfrom
feat/add-exception-to-verification-failed-callback

Conversation

@flxapps
Copy link

@flxapps flxapps commented Oct 7, 2025

This PR enhances error handling by adding an optional SecReaderException parameter to the onVerificationFailed callback in SecWidget and SecModalBuilder. This provides developers with detailed information about why a verification process failed, enabling more specific error handling.

Changes include:

  • Updated the onVerificationFailed callback signature across SecWidget, SecModalBuilder, the example app, and tests.
  • Propagated the SecReaderException from the underlying logic to the UI layer.
  • Updated the README.md to document the new callback parameter and explain its usage.

Breaking Changes

⚠️ This is a breaking change

All consumers must update their onVerificationFailed callback:

Before:

onVerificationFailed: () {
  print('Identification failed');
}

After:

onVerificationFailed: (exception) {
  print('Verification failed: ${exception.message}');
}

@flxapps flxapps self-assigned this Oct 7, 2025
@flxapps flxapps changed the base branch from main to dev October 7, 2025 10:41
@flxapps flxapps force-pushed the feat/add-exception-to-verification-failed-callback branch from 06d5ee3 to 58df0c4 Compare October 7, 2025 11:03
Copilot AI review requested due to automatic review settings October 7, 2025 11:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds propagation of SecReaderException to onVerificationFailed callbacks to improve error diagnostics and handling across SecWidget and SecModalBuilder.

  • Passes exception details from lower layers to UI callbacks.
  • Introduces SecResultFailed.exception and updates example, README, and tests to new signatures.

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lib/src/ui/sec_widget.dart Adds exception-typed onVerificationFailed and forwards exception; updates button handler and child callback wiring.
lib/src/ui/sec_modal.dart Makes onVerificationFailed accept exception; adds SecResultFailed(exception) and forwards it through modal result.
lib/src/ui/scanning_view.dart Forwards underlying exception to onVerificationFailed; updates button handler.
test/sec_widget_test.dart Adjusts tests to new callback arity.
example/lib/main.dart Updates example to log received exception; minor import reorder.
README.md Documents the new exception parameter for onVerificationFailed.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@flxapps flxapps force-pushed the feat/add-exception-to-verification-failed-callback branch from 1975d58 to e562c72 Compare October 7, 2025 11:43
@flxapps flxapps requested a review from ElectricCookie October 7, 2025 12:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@flxapps flxapps changed the title feat: Add exception to onVerificationFailed callback feat!: Add exception to onVerificationFailed callback Oct 8, 2025
Copy link
Collaborator

@ElectricCookie ElectricCookie left a comment

Choose a reason for hiding this comment

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

Please add a test using virtual strategy to simulate the error being thrown and correctly passed back to the widget

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 47 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 47 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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