-
Notifications
You must be signed in to change notification settings - Fork 1.9k
remove redundant try-catch in JdbcChatMemoryRepository #4288
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
remove redundant try-catch in JdbcChatMemoryRepository #4288
Conversation
The inner method JdbcChatMemoryRepositoryDialect#from already contains exception handling logic. The outer try-catch block is unnecessary and can be safely removed to avoid redundant exception handling and improve code clarity. Signed-off-by: eeaters <870905780@qq.com>
Thank you for your contribution! However, I think the current approach of silently ignoring exceptions in the |
Yes; I just had doubts about the default return of PostgresChatMemoryRepositoryDialect while reading the code here. In comparison, I think directly throwing an exception internally would be more acceptable to me; or maybe the previous person was using a PostgreSQL database. Haha. |
While reading the code, I noticed the try-catch block, but I found that the method does not throw any exceptions internally. This made me reread the code repeatedly. Therefore, I think it might be better to either remove the exception handling (with adjustments made later if necessary) or simply avoid using try-catch here for now. I saw your commit; you changed the code style, but the default behavior still returns the PostgreSQL database. Shouldn’t we just keep it consistent? |
Sorry for the confusion. Actually, in my initial commits, I did follow the approach you suggested—propagating the connection exception upward. However, this approach failed the |
The inner method JdbcChatMemoryRepositoryDialect#from already contains exception handling logic. The outer try-catch block is unnecessary and can be safely removed to avoid redundant exception handling and improve code clarity. Fixes: #4288 Signed-off-by: eeaters <870905780@qq.com> (cherry picked from commit eda3c74)
…ts#4288) The inner method JdbcChatMemoryRepositoryDialect#from already contains exception handling logic. The outer try-catch block is unnecessary and can be safely removed to avoid redundant exception handling and improve code clarity. Fixes: spring-projects#4288 Auto-cherry-pick to 1.0.x Signed-off-by: eeaters <870905780@qq.com>
The inner method JdbcChatMemoryRepositoryDialect#from already contains exception handling logic. The outer try-catch block is unnecessary and can be safely removed to avoid redundant exception handling and improve code clarity.