added type checking on panic returns, added some test for the errorhandler