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

Throw Exceptions instead of Errors #516

Closed
fabiankessler opened this issue May 22, 2015 · 5 comments
Closed

Throw Exceptions instead of Errors #516

fabiankessler opened this issue May 22, 2015 · 5 comments

Comments

@fabiankessler
Copy link

Currently there are some open issues where MapDB throws an Error. A quick search brought up these recent ones:

AssertionError:
#513
#515
#509
#451

IOError:
#514

Even if these issues are not fixed soon, I recommend to catch and throw an exception instead.
Because of an Error an application using MapDB aborts. With an exception the app could detect an issue in MapDB, and drop the whole storage, without knowing what exactly went wrong, and start over with a fresh one.

@bwzhang2011
Copy link

+1

@jankotek
Copy link
Owner

There is long discussion about checked/unchecked exception. MapDB implements Map interface so we must wrap IOException into IOErrors.

MapDB simple expects IO errors to be inrecoverable. Users should close and reopen the store. WAL should be replayed in case of errors etc. It is too low-level and there is not really option to add something better without more layers and overhead.

MapDB 2.0 is better. It outputs warnings into logger. It also has exception hierarchy with better error messages. Assertions will also give better description.

Also MapDB 2.0 file format is much more robust. There are checksums and bit parity checks, so it detects data corruption much earlier.

@jankotek
Copy link
Owner

MapDB 2.0 now has exception hierarchy. It throws different exceptions for different types of errors.

@rage-shadowman
Copy link

@jankotek, the discussion about checked/unchecked exceptions is irrelevant. This is about Error being thrown (as opposed to some extension of RuntimeException -- neither of which are checked).

@jankotek
Copy link
Owner

jankotek commented Aug 3, 2015 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants