SnappyDB icon indicating copy to clipboard operation
SnappyDB copied to clipboard

Question: Overuse of Exception

Open adrian-chang opened this issue 10 years ago • 1 comments

This is more of a question of design rather than a problem, but why does every method basically throw an exception?

I think overall the library should reduce the use of exceptions as it causes unnecessary try and catch blocks.

It does make sense in some cases to fail if it's really an issue, but it seems that all of the get* methods should just return null or the value if found or if there's not an issue.

For put methods you can return boolean true or false if it was successful or a problem.

It just seems like exceptions should be used for either really critical or dumb mistakes (IE I forgot to close the database connection) instead of normal things where users of the library should check their code themselves (IE use the right get method).

adrian-chang avatar Sep 16 '14 02:09 adrian-chang

+1

LouisCAD avatar Aug 20 '15 15:08 LouisCAD