Updated SettingsForm::test_connection to catch errors and get correct response code