Skip to content

Commit 1837ad6

Browse files
Rikdekkerclaude
andcommitted
Improve telemetry error handling with specific server feedback
- Add sendReportWithDetails() to TelemetryService for detailed error info - Show NcNoteCard with specific error message after sending report - Add translations for telemetry feedback messages (en/nl/de/fr) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 85b15b3 commit 1837ad6

11 files changed

Lines changed: 96 additions & 21 deletions

File tree

l10n/de.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,5 +823,9 @@ OC.L10N.register('formvox', {
823823
"Your organization (optional)": "Ihre Organisation (optional)",
824824
"View subscription options": "Abonnementoptionen anzeigen",
825825
"Your FormVox installation has exceeded the free tier limits (25 forms or 50 users). Consider subscribing to support ongoing development.": "Ihre FormVox-Installation hat die kostenlosen Grenzen \u00fcberschritten (25 Formulare oder 50 Benutzer). Erw\u00e4gen Sie ein Abonnement, um die weitere Entwicklung zu unterst\u00fctzen.",
826-
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Ihr FormVox-Abonnementschl\u00fcssel ist ung\u00fcltig oder abgelaufen. Erneuern Sie ihn, um weiterhin Support zu erhalten."
826+
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Ihr FormVox-Abonnementschl\u00fcssel ist ung\u00fcltig oder abgelaufen. Erneuern Sie ihn, um weiterhin Support zu erhalten.",
827+
"Report sent successfully": "Bericht erfolgreich gesendet",
828+
"The telemetry server returned an error:": "Der Telemetrie-Server hat einen Fehler zur\u00fcckgegeben:",
829+
"Could not reach the telemetry server. Please try again later.": "Der Telemetrie-Server ist nicht erreichbar. Bitte versuchen Sie es sp\u00e4ter erneut.",
830+
"Failed to send report": "Bericht konnte nicht gesendet werden"
827831
}, 'nplurals=2; plural=(n != 1);');

l10n/de.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,11 @@
827827
"Your organization (optional)": "Ihre Organisation (optional)",
828828
"View subscription options": "Abonnementoptionen anzeigen",
829829
"Your FormVox installation has exceeded the free tier limits (25 forms or 50 users). Consider subscribing to support ongoing development.": "Ihre FormVox-Installation hat die kostenlosen Grenzen überschritten (25 Formulare oder 50 Benutzer). Erwägen Sie ein Abonnement, um die weitere Entwicklung zu unterstützen.",
830-
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Ihr FormVox-Abonnementschlüssel ist ungültig oder abgelaufen. Erneuern Sie ihn, um weiterhin Support zu erhalten."
830+
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Ihr FormVox-Abonnementschlüssel ist ungültig oder abgelaufen. Erneuern Sie ihn, um weiterhin Support zu erhalten.",
831+
"Report sent successfully": "Bericht erfolgreich gesendet",
832+
"The telemetry server returned an error:": "Der Telemetrie-Server hat einen Fehler zurückgegeben:",
833+
"Could not reach the telemetry server. Please try again later.": "Der Telemetrie-Server ist nicht erreichbar. Bitte versuchen Sie es später erneut.",
834+
"Failed to send report": "Bericht konnte nicht gesendet werden"
831835
},
832836
"pluralForm": "nplurals=2; plural=(n != 1);"
833837
}

l10n/en.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,5 +823,9 @@ OC.L10N.register('formvox', {
823823
"1000+ users": "1000+ users",
824824
"\u20ac19/year": "\u20ac19/year",
825825
"\u20ac59/year": "\u20ac59/year",
826-
"\u20ac139/year": "\u20ac139/year"
826+
"\u20ac139/year": "\u20ac139/year",
827+
"Report sent successfully": "Report sent successfully",
828+
"The telemetry server returned an error:": "The telemetry server returned an error:",
829+
"Could not reach the telemetry server. Please try again later.": "Could not reach the telemetry server. Please try again later.",
830+
"Failed to send report": "Failed to send report"
827831
}, 'nplurals=2; plural=(n != 1);');

l10n/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,11 @@
827827
"1000+ users": "1000+ users",
828828
"€19/year": "€19/year",
829829
"€59/year": "€59/year",
830-
"€139/year": "€139/year"
830+
"€139/year": "€139/year",
831+
"Report sent successfully": "Report sent successfully",
832+
"The telemetry server returned an error:": "The telemetry server returned an error:",
833+
"Could not reach the telemetry server. Please try again later.": "Could not reach the telemetry server. Please try again later.",
834+
"Failed to send report": "Failed to send report"
831835
},
832836
"pluralForm": "nplurals=2; plural=(n != 1);"
833837
}

l10n/fr.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,5 +823,9 @@ OC.L10N.register('formvox', {
823823
"Your organization (optional)": "Votre organisation (optionnel)",
824824
"View subscription options": "Voir les options d'abonnement",
825825
"Your FormVox installation has exceeded the free tier limits (25 forms or 50 users). Consider subscribing to support ongoing development.": "Votre installation FormVox a d\u00e9pass\u00e9 les limites gratuites (25 formulaires ou 50 utilisateurs). Envisagez de vous abonner pour soutenir le d\u00e9veloppement continu.",
826-
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Votre cl\u00e9 d'abonnement FormVox est invalide ou expir\u00e9e. Renouvelez-la pour continuer \u00e0 b\u00e9n\u00e9ficier du support."
826+
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Votre cl\u00e9 d'abonnement FormVox est invalide ou expir\u00e9e. Renouvelez-la pour continuer \u00e0 b\u00e9n\u00e9ficier du support.",
827+
"Report sent successfully": "Rapport envoy\u00e9 avec succ\u00e8s",
828+
"The telemetry server returned an error:": "Le serveur de t\u00e9l\u00e9m\u00e9trie a renvoy\u00e9 une erreur :",
829+
"Could not reach the telemetry server. Please try again later.": "Impossible de joindre le serveur de t\u00e9l\u00e9m\u00e9trie. Veuillez r\u00e9essayer plus tard.",
830+
"Failed to send report": "\u00c9chec de l'envoi du rapport"
827831
}, 'nplurals=2; plural=(n != 1);');

l10n/fr.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,11 @@
827827
"Your organization (optional)": "Votre organisation (optionnel)",
828828
"View subscription options": "Voir les options d'abonnement",
829829
"Your FormVox installation has exceeded the free tier limits (25 forms or 50 users). Consider subscribing to support ongoing development.": "Votre installation FormVox a dépassé les limites gratuites (25 formulaires ou 50 utilisateurs). Envisagez de vous abonner pour soutenir le développement continu.",
830-
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Votre clé d'abonnement FormVox est invalide ou expirée. Renouvelez-la pour continuer à bénéficier du support."
830+
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Votre clé d'abonnement FormVox est invalide ou expirée. Renouvelez-la pour continuer à bénéficier du support.",
831+
"Report sent successfully": "Rapport envoyé avec succès",
832+
"The telemetry server returned an error:": "Le serveur de télémétrie a renvoyé une erreur :",
833+
"Could not reach the telemetry server. Please try again later.": "Impossible de joindre le serveur de télémétrie. Veuillez réessayer plus tard.",
834+
"Failed to send report": "Échec de l'envoi du rapport"
831835
},
832836
"pluralForm": "nplurals=2; plural=(n != 1);"
833837
}

l10n/nl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,5 +823,9 @@ OC.L10N.register('formvox', {
823823
"Your organization (optional)": "Uw organisatie (optioneel)",
824824
"View subscription options": "Abonnementsopties bekijken",
825825
"Your FormVox installation has exceeded the free tier limits (25 forms or 50 users). Consider subscribing to support ongoing development.": "Uw FormVox-installatie heeft de gratis limieten overschreden (25 formulieren of 50 gebruikers). Overweeg een abonnement om de verdere ontwikkeling te ondersteunen.",
826-
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Uw FormVox-abonnementssleutel is ongeldig of verlopen. Verleng om ondersteuning te blijven ontvangen."
826+
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Uw FormVox-abonnementssleutel is ongeldig of verlopen. Verleng om ondersteuning te blijven ontvangen.",
827+
"Report sent successfully": "Rapport succesvol verstuurd",
828+
"The telemetry server returned an error:": "De telemetrieserver gaf een fout:",
829+
"Could not reach the telemetry server. Please try again later.": "Kan de telemetrieserver niet bereiken. Probeer het later opnieuw.",
830+
"Failed to send report": "Rapport versturen mislukt"
827831
}, 'nplurals=2; plural=(n != 1);');

l10n/nl.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,11 @@
827827
"Your organization (optional)": "Uw organisatie (optioneel)",
828828
"View subscription options": "Abonnementsopties bekijken",
829829
"Your FormVox installation has exceeded the free tier limits (25 forms or 50 users). Consider subscribing to support ongoing development.": "Uw FormVox-installatie heeft de gratis limieten overschreden (25 formulieren of 50 gebruikers). Overweeg een abonnement om de verdere ontwikkeling te ondersteunen.",
830-
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Uw FormVox-abonnementssleutel is ongeldig of verlopen. Verleng om ondersteuning te blijven ontvangen."
830+
"Your FormVox subscription key is invalid or expired. Please renew to continue receiving support.": "Uw FormVox-abonnementssleutel is ongeldig of verlopen. Verleng om ondersteuning te blijven ontvangen.",
831+
"Report sent successfully": "Rapport succesvol verstuurd",
832+
"The telemetry server returned an error:": "De telemetrieserver gaf een fout:",
833+
"Could not reach the telemetry server. Please try again later.": "Kan de telemetrieserver niet bereiken. Probeer het later opnieuw.",
834+
"Failed to send report": "Rapport versturen mislukt"
831835
},
832836
"pluralForm": "nplurals=2; plural=(n != 1);"
833837
}

lib/Controller/StatisticsController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,17 @@ public function sendTelemetry(): DataResponse
6767
$this->telemetryService->setEnabled(true);
6868
}
6969

70-
$success = $this->telemetryService->sendReport();
70+
$result = $this->telemetryService->sendReportWithDetails();
7171

7272
// Restore original state
7373
if (!$wasEnabled) {
7474
$this->telemetryService->setEnabled(false);
7575
}
7676

7777
return new DataResponse([
78-
'success' => $success,
78+
'success' => $result['success'],
79+
'reason' => $result['reason'] ?? null,
80+
'message' => $result['message'] ?? null,
7981
'lastReport' => $this->telemetryService->getLastReportTime(),
8082
]);
8183
}

lib/Service/TelemetryService.php

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,18 @@ public function getTelemetryUrl(): string
7373
* @return bool Success status
7474
*/
7575
public function sendReport(): bool
76+
{
77+
return $this->sendReportWithDetails()['success'];
78+
}
79+
80+
/**
81+
* Send telemetry report to the server with detailed error info
82+
* @return array{success: bool, reason?: string, message?: string}
83+
*/
84+
public function sendReportWithDetails(): array
7685
{
7786
if (!$this->isEnabled()) {
78-
$this->logger->debug('TelemetryService: Telemetry is disabled, skipping report');
79-
return false;
87+
return ['success' => false, 'reason' => 'disabled'];
8088
}
8189

8290
try {
@@ -107,16 +115,23 @@ public function sendReport(): bool
107115
(string)time()
108116
);
109117

110-
return true;
118+
return ['success' => true];
111119
}
112120

113-
// Silent fail - server may not be ready yet
114-
// TODO v1.3: Add proper error logging once server is stable
115-
return false;
121+
return ['success' => false, 'reason' => 'server_error', 'message' => 'HTTP ' . $statusCode];
116122
} catch (\Exception $e) {
117-
// Silent fail - server may not be available
118-
// TODO v1.3: Add proper error logging once server is stable
119-
return false;
123+
$message = $e->getMessage();
124+
if (method_exists($e, 'getResponse') && $e->getResponse() !== null) {
125+
$body = (string) $e->getResponse()->getBody();
126+
$json = json_decode($body, true);
127+
if (isset($json['error'])) {
128+
$message = $json['error'];
129+
} elseif (!empty($body) && strlen($body) < 200) {
130+
$message = $body;
131+
}
132+
}
133+
$this->logger->warning('TelemetryService: Failed to send report: ' . $message);
134+
return ['success' => false, 'reason' => 'error', 'message' => $message];
120135
}
121136
}
122137

0 commit comments

Comments
 (0)