Skip to content
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

Create an enum for valid device rotations #4125

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bieleluk
Copy link

@bieleluk bieleluk commented Aug 26, 2024

fixes #4041

@bieleluk bieleluk changed the title #4041 Create an enum for valid device rotations Create an enum for valid device rotations Aug 26, 2024
@matejcik matejcik marked this pull request as draft August 26, 2024 11:23
label = TR.rotation__west
else:
raise DataError("Unsupported display rotation")
raise ValueError(f"Unsupported display rotation: {rotation}")
Copy link
Contributor

Choose a reason for hiding this comment

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

use a RuntimeError here, this cannot happen because your if/elif is exhaustive

also don't use generic errors with texts https://docs.trezor.io/trezor-firmware/core/misc/exceptions.html

dtto below

Copy link
Author

Choose a reason for hiding this comment

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

core/src/storage/device.py Outdated Show resolved Hide resolved
core/src/storage/device.py Outdated Show resolved Hide resolved
@bieleluk bieleluk marked this pull request as ready for review August 27, 2024 14:26
@andrewkozlik andrewkozlik removed their request for review August 27, 2024 15:01
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.

Create an enum for valid device rotations
2 participants