-
Notifications
You must be signed in to change notification settings - Fork 237
[Enhancement] Camera connection errors: Provide better error message #748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
src/seedsigner/hardware/camera.py
Outdated
self._video_stream.start() | ||
except PiCameraError: | ||
# This error most often occurs because the camera connection is loose | ||
from seedsigner.hardware.camera import CameraConnectionError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CameraConnectionError
is being imported here even though it's defined in the same file — is there a specific reason for that? Just checking in case I'm missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, nice catch!
I had originally put this try
/except
in PiVideoStream
but when I moved it here the now-unnecessary import came along with it.
616faa2
to
a7a4f8c
Compare
CACK |
The problem
When the camera cable is not properly / fully connected, any attempt to access the camera (live preview video, I/O test still image capture) results in this misleading error:
This PR
PiCameraError
and shows a more useful error message via a new custom error handlerCameraConnectionErrorView
:Implementation note
The test suite and screenshot generator now extend the module mock:
This is because the
UnhandledExceptionView
now tests forCameraConnectionError.__name__
which will be unavailable if the original module mock as unchanged (theseedsigner.hardware.camera.CameraConnectionError
class would be mocked out of existence and that View would throw an error when trying to access the now nonexistent error class's__name__
).How to test
Boot a SeedSigner with its camera disconnected. Access any View that relies on camera data (e.g. "Scan" from Home, Load Seed via SeedQR, New Seed via image entropy, I/O test still image, etc).
Misc:
Minor button label changes on error screens from "Done" or "I understand" to "Back to Main Menu":
This pull request is categorized as a:
Checklist
pytest
and made sure all unit tests pass before sumbitting the PRIf you modified or added functionality/workflow, did you add new unit tests?
I have tested this PR on the following platforms/os: