Bug fix error processing for installation cubits

pull/91/head
NaiJi ✨ 2022-06-15 04:55:45 +03:00
parent 3024016fe2
commit 313cfc7187
6 changed files with 27 additions and 11 deletions

View File

@ -259,6 +259,9 @@
"1": "Connect a server",
"2": "A place where your data and SelfPrivacy services will reside:",
"how": "How to obtain API token",
"hetzner_bad_key_error": "Hetzner API key is invalid",
"cloudflare_bad_key_error": "Cloudflare API key is invalid",
"backblaze_bad_key_error": "Backblaze storage information is invalid",
"3": "Connect CloudFlare",
"4": "To manage your domain's DNS",
"5": "CloudFlare API Token",

View File

@ -260,6 +260,9 @@
"1": "Подключите сервер",
"2": "Здесь будут жить наши данные и SelfPrivacy-сервисы",
"how": "Как получить API Token",
"hetzner_bad_key_error": "Hetzner API ключ неверен",
"cloudflare_bad_key_error": "Cloudflare API ключ неверен",
"backblaze_bad_key_error": "Информация о Backblaze хранилище неверна",
"3": "Подключите CloudFlare",
"4": "Для управления DNS вашего домена",
"5": "CloudFlare API Token",

View File

@ -55,10 +55,11 @@ class BackblazeFormCubit extends FormCubit {
}
if (!isKeyValid) {
keyId.setError('bad key');
applicationKey.setError('bad key');
keyId.setError('initializing.backblaze_bad_key_error'.tr());
applicationKey.setError('initializing.backblaze_bad_key_error'.tr());
return false;
}
return true;
}
}

View File

@ -42,12 +42,14 @@ class CloudFlareFormCubit extends FormCubit {
isKeyValid = await apiClient.isValid(apiKey.state.value);
} catch (e) {
addError(e);
isKeyValid = false;
}
if (!isKeyValid) {
apiKey.setError('bad key');
apiKey.setError('initializing.cloudflare_bad_key_error'.tr());
return false;
}
return true;
}
}

View File

@ -42,12 +42,14 @@ class HetznerFormCubit extends FormCubit {
isKeyValid = await apiClient.isValid(apiKey.state.value);
} catch (e) {
addError(e);
isKeyValid = false;
}
if (!isKeyValid) {
apiKey.setError('bad key');
apiKey.setError('initializing.hetzner_bad_key_error'.tr());
return false;
}
return true;
}
}

View File

@ -242,13 +242,18 @@ class ServerInstallationRepository {
domainName: domainName,
);
final ServerHostingDetails? serverDetails =
await hetznerApi.createServer(
cloudFlareKey: cloudFlareKey,
rootUser: rootUser,
domainName: domainName,
dataBase: dataBase,
);
ServerHostingDetails? serverDetails;
try {
serverDetails = await hetznerApi.createServer(
cloudFlareKey: cloudFlareKey,
rootUser: rootUser,
domainName: domainName,
dataBase: dataBase,
);
} catch (e) {
print(e);
}
if (serverDetails == null) {
print('Server is not initialized!');
return;