Closed gavofyork closed 7 years ago
Took a stab at sweeping the panics from the blockchain module: https://github.com/ethcore/parity/tree/blockchain-panics
The issue is that you have to start making everything that used to return Option<T>
to return a Result<Option<T>, String>
in order to bubble up database errors. There are a couple problems here:
try!
invocations. The code becomes less readableString
. So even once handling could be in place, the only thing we can still do is panic.So I would suggest (and @NikVolf and @arkpar I would appreciate your input on this as well) that our kvdb
wrapper should not return errors at all, but should retry N
(= 5?) times upon encountering one internally, warning on each error and panicking if success never occurs.
Additionally it seems that the kvdb
wrapper is best equipped to do stuff like reopen the underlying rocksdb instance, check that the directory still exists, etc.
I've made various PRs to sweep just about all unwraps from the codebase. There might be a few stragglers but it's mostly taken care of.
I'll make an additional PR that takes care of network and IO crates
@arkpar / @rphmeier is this pretty much done, now?
assuming so.
.expect
andassert!
should all have strings of the form:e.g.
Any other panickers (e.g. subscripting) must have an additional
assert!
prepended so they fail with an error message as early as possible.