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

Exception Handling #17

Closed
vidhvath28 opened this issue Oct 4, 2024 · 1 comment
Closed

Exception Handling #17

vidhvath28 opened this issue Oct 4, 2024 · 1 comment
Assignees

Comments

@vidhvath28
Copy link

Consider whether any of the methods should explicitly handle exceptions. For instance, in the fromBytes method, what happens if the decoded value is shorter than expected? Should this throw an exception, or should it handle it gracefully?

@gustavofreze
Copy link
Member

The fromBytes method already handles the potential issue of a decoded value being shorter than expected. The constructor of the Payload class validates the payload size and throws an InvalidPayloadSize exception if it does not match the required 16 bytes. This ensures that any issues with payload length are consistently handled through exception throwing, maintaining robustness without redundant checks.

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

No branches or pull requests

2 participants