Skip to content

Change DimensionSetExceededException to a checked exception #122

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

Merged
merged 6 commits into from
Sep 16, 2022

Conversation

markkuhn
Copy link
Contributor

@markkuhn markkuhn commented Sep 8, 2022

Issue #, if available: #120

Description of changes:
Change DimensionSetExceededException to a checked exception.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@markkuhn markkuhn self-assigned this Sep 8, 2022
@markkuhn markkuhn added the bug Something isn't working label Sep 8, 2022
@markkuhn markkuhn linked an issue Sep 14, 2022 that may be closed by this pull request
Copy link
Member

@gordonpn gordonpn left a comment

Choose a reason for hiding this comment

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

Are there tests to make sure that the checked exception are thrown when we expect them to be thrown?

@markkuhn
Copy link
Contributor Author

markkuhn commented Sep 15, 2022

Are there tests to make sure that the checked exception are thrown when we expect them to be thrown?

Those tests can be found in DimensionSetTest.java. They were written as part of #103. Since I'm only changing the exception type I didn't need to write new tests.

@markkuhn markkuhn requested a review from gordonpn September 15, 2022 16:29
@markkuhn markkuhn merged commit 005f734 into awslabs:master Sep 16, 2022
@jqmichael
Copy link

@markkuhn @gordonpn

Returning checked exception made consumer hard to upgrade. I don't think it's a pattern to use checked exception in AWS SDK.

Why unchecked exceptions?
The AWS SDK for Java uses runtime (or unchecked) exceptions instead of checked exceptions for these reasons:

To allow developers fine-grained control over the errors they want to handle without forcing them to handle exceptional cases they aren’t concerned about (and making their code overly verbose)

To prevent scalability issues inherent with checked exceptions in large applications

In general, checked exceptions work well on small scales, but can become troublesome as applications grow and become more complex.

https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/handling-exceptions.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unchecked exception when max number of dimensions exceeded
4 participants