move catch_registration_errors() to a separate file