Skip to content

fix: report INVALID_PARAMETERS_ERROR instead of a generic scanning error - #65

Merged
alexgerardojacinto merged 2 commits into
mainfrom
fix/map-invalid-parameters-error
Dec 4, 2026
Merged

alexgerardojacinto merged 2 commits into
mainfrom
fix/map-invalid-parameters-error

Conversation

@alexgerardojacinto

Copy link
Copy Markdown
Collaborator

Description

Follow-up to #58. When SCAN_PARAMETERS is missing, OSBARCScannerActivity now finishes with INVALID_PARAMETERS_ERROR, but OSBARCController.handleActivityResult had no branch for that result code. It fell into the else and callers received SCANNING_GENERAL_ERROR instead of "Scanning parameters are invalid".

This PR:

Type of changes

  • Fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Refactor (cosmetic changes)
  • Breaking change (change that would cause existing functionality to not work as expected)

Tests

New unit test givenInvalidParametersResultCodeWhenHandleScanResultThenInvalidParametersError in ScanCodeTests. Not run locally: all tests in ScanCodeTests fail on my machine because Mockito cannot mock android.app.Activity on JDK 21 (CI uses JDK 17), so I'm relying on CI.

Checklist

  • Code follows code style of this project
  • CHANGELOG.md file is correctly updated
  • Changes require an update to the documentation
    • Documentation has been updated accordingly

OSBARCController.handleActivityResult had no branch for the
INVALID_PARAMETERS_ERROR result code, so the error finished by
OSBARCScannerActivity when SCAN_PARAMETERS is missing (#58) was reported
to callers as SCANNING_GENERAL_ERROR. Map it, add a unit test and the
changelog entry for #58.
@alexgerardojacinto
alexgerardojacinto marked this pull request as ready for review December 2, 2026 13:05
@alexgerardojacinto
alexgerardojacinto requested a review from a team as a code owner December 2, 2026 13:05
@alexgerardojacinto
alexgerardojacinto requested review from markemer and theproducer and removed request for a team December 2, 2026 13:05
@alexgerardojacinto
alexgerardojacinto merged commit be00403 into main Dec 4, 2026
7 checks passed
@alexgerardojacinto alexgerardojacinto mentioned this pull request Dec 4, 2026
1 task done
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