Improvements to handling of Error (#1285)* Remove usage of AssertionError* Improve handling of Errors (commit: df4848a)