-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support UnrecoverableException #898
Conversation
c89e27a
to
b66aac0
Compare
* Represents an unrecoverable exception in session management and statement execution. This | ||
* exception is used for errors that cannot be handled or recovered from. | ||
*/ | ||
class UnrecoverableException private (message: String, cause: Throwable) |
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.
Why do we need to hide constructor?
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.
Why do we need to hide constructor?
Using "factory method pattern" is a common practice in Scala
- Readability: Using UnrecoverableException(cause) is often more readable than new UnrecoverableException(cause).
- Immutability: It can help enforce immutability by preventing direct instantiation of the class.
- Subclassing control: By making the constructor private, you prevent other classes from directly subclassing UnrecoverableException.
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.
I think factory pattern is normally used when we want to create instance of different classes for the same interface based on the parameters. (In this case, if we create different type of instance for UnrecoverableException, it makes more sense).
For 3, do we have reason to avoid subclassing of UnrecoverableException?
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.
I think factory pattern is normally used when we want to create instance of different classes for the same interface based on the parameters. (In this case, if we create different type of instance for UnrecoverableException, it makes more sense).
factory method / static factory method is much simpler than the full-fledged Factory Pattern—still valuable, but primarily used to hide constructor complexity and ensure uniform creation rather than managing multiple types.
Users of the class can directly call UnrecoverableException(...) without needing to understand which specific constructors are available.
For 3, do we have reason to avoid subclassing of UnrecoverableException?
Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Louis Chu <[email protected]>
b66aac0
to
ba00ba5
Compare
* Support UnrecoverableException Signed-off-by: Louis Chu <[email protected]> * Add UT and IT Signed-off-by: Louis Chu <[email protected]> --------- Signed-off-by: Louis Chu <[email protected]> (cherry picked from commit 4f58bc8) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Support UnrecoverableException Signed-off-by: Louis Chu <[email protected]> * Add UT and IT Signed-off-by: Louis Chu <[email protected]> --------- Signed-off-by: Louis Chu <[email protected]> (cherry picked from commit 4f58bc8) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Support UnrecoverableException * Add UT and IT --------- (cherry picked from commit 4f58bc8) Signed-off-by: Louis Chu <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Support UnrecoverableException * Add UT and IT --------- (cherry picked from commit 4f58bc8) Signed-off-by: Louis Chu <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Support UnrecoverableException Signed-off-by: Louis Chu <[email protected]> * Add UT and IT Signed-off-by: Louis Chu <[email protected]> --------- Signed-off-by: Louis Chu <[email protected]>
Description
Improve entry point exception handling by:
Check List
--signoff
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.