use a custom exception instead of `assert` in case reconciliation

This commit doesn't do much, just some cleanup and getting acquainted with the code