Integrations: Manage the error of provided integrations server not responding

This commit is contained in:
manuroe 2019-06-21 15:06:41 +02:00
parent 948105b03d
commit 918adc5b7a
4 changed files with 15 additions and 2 deletions

View file

@ -635,6 +635,7 @@
// Widget
"widget_no_integrations_server_configured" = "No integrations server configured";
"widget_integrations_server_failed_to_connect" = "Failed to connect to integrations server";
"widget_no_power_to_manage" = "You need permission to manage widgets in this room";
"widget_creation_failure" = "Widget creation has failed";
"widget_sticker_picker_no_stickerpacks_alert" = "You don't currently have any stickerpacks enabled.";

View file

@ -2834,6 +2834,10 @@ internal enum VectorL10n {
internal static var widgetIntegrationUnableToCreate: String {
return VectorL10n.tr("Vector", "widget_integration_unable_to_create")
}
/// Failed to connect to integrations server
internal static var widgetIntegrationsServerFailedToConnect: String {
return VectorL10n.tr("Vector", "widget_integrations_server_failed_to_connect")
}
/// No integrations server configured
internal static var widgetNoIntegrationsServerConfigured: String {
return VectorL10n.tr("Vector", "widget_no_integrations_server_configured")

View file

@ -55,7 +55,8 @@ typedef enum : NSUInteger
{
WidgetManagerErrorCodeNotEnoughPower,
WidgetManagerErrorCodeCreationFailed,
WidgetManagerErrorCodeNoIntegrationsServerConfigured
WidgetManagerErrorCodeNoIntegrationsServerConfigured,
WidgetManagerErrorCodeFailedToConnectToIntegrationsServer
}
WidgetManagerErrorCode;

View file

@ -548,10 +548,17 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
}
} failure:^(NSError *error) {
NSLog(@"[WidgetManager] registerForScalarToken. Error in modular/register request");
NSLog(@"[WidgetManager] registerForScalarToken: Failed to register. Error: %@", error);
if (failure)
{
// Specialise the error
NSError *error = [NSError errorWithDomain:WidgetManagerErrorDomain
code:WidgetManagerErrorCodeFailedToConnectToIntegrationsServer
userInfo:@{
NSLocalizedDescriptionKey: NSLocalizedStringFromTable(@"widget_integrations_server_failed_to_connect", @"Vector", nil)
}];
failure(error);
}
}];