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 clear exception handling of invalid inputs #4

Open
Col-E opened this issue Apr 14, 2022 · 1 comment
Open

Create clear exception handling of invalid inputs #4

Col-E opened this issue Apr 14, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@Col-E
Copy link
Owner

Col-E commented Apr 14, 2022

For a sample: Col-E/Recaf#373

Essentially, if the input isn't parsable ensure the reason why is clearly described in a thrown exception. Allows the library user to handle invalid files easily without having to check for themselves.

@Col-E Col-E added the enhancement New feature or request label Apr 14, 2022
@Col-E
Copy link
Owner Author

Col-E commented May 29, 2024

Another recent case:

java.lang.IllegalArgumentException: newLimit < 0: (-10 < 0)
        at java.base/java.nio.Buffer.createLimitException(Buffer.java:395)
        at java.base/java.nio.Buffer.limit(Buffer.java:369)
        at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:1529)
        at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:267)
        at software.coley.lljzip.util.ByteDataUtil.sliceExact(ByteDataUtil.java:302)
        at software.coley.lljzip.util.BufferData.slice(BufferData.java:83)
        at software.coley.lljzip.util.ByteData.sliceOf(ByteData.java:108)
        at software.coley.lljzip.util.ByteDataUtil.lambda$readLazyLongSlice$7(ByteDataUtil.java:508)
        at software.coley.lljzip.util.lazy.LazyByteData.get(LazyByteData.java:49)

Error provided by user. It would be ideal to have each ByteData be assigned a label and to rethrow errors to contain that label so we can have some idea of where the issue comes from when we are not provided with a sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant