fix(android): a failed save can no longer hang on "Saving..."

The except only covered decryption and the patch. An exception from
re-encryption or from the PUT skipped the block that restores the screen - and
that block also held the message, so the failure was invisible as well as
permanent: the row stayed on "Saving..." with nothing to explain it.

Restoring the screen now lives in the finally, so it happens whatever the code
above did. A catch-all around the body turns any unforeseen exception into a
message and a log line, because a failure that says nothing is indistinguishable
from slowness - which is exactly how this one was reported.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-08-17 20:01:18 +01:00
parent b9a3b3e748
commit 4d9fd2c34a
+24 -8
View File
@@ -586,6 +586,7 @@ begin
LClient := TSyncClient.Create(FUrl, FToken);
LDone := False;
LErr := '';
try
try
for LAttempt := 1 to 3 do
begin
@@ -652,17 +653,32 @@ begin
end
else
WebCall('PM.toast(' + JsArg('Not saved - ' + LErr) + ')');
// LE DETAIL DOIT REVENIR, dans les deux cas. AdoptVault reconstruit
// la LISTE ; la ligne en cours d'edition restait telle quelle, donc
// le champ de saisie demeurait a l'ecran et rien ne disait si
// l'enregistrement avait abouti. On la redessine depuis le coffre :
// apres un succes elle porte la nouvelle valeur, apres un echec
// l'ancienne - ce qui se lit sans commentaire.
ReopenEntryByUuid(LUuid);
end);
except
// FILET. Le rechiffrement et le PUT sont hors du try qui
// couvre le dechiffrement : une exception y sortait sans un mot,
// et l'echec devenait indiscernable d'une lenteur.
on E: Exception do
begin
LErr := E.ClassName + ': ' + E.Message;
Log('save FAILED: ' + LErr);
TThread.Queue(nil, procedure
begin WebCall('PM.toast(' + JsArg('Not saved - ' + LErr) + ')'); end);
end;
end;
finally
LClient.Free;
TThread.Queue(nil, procedure begin SetBusy(False); end);
// LA REMISE EN ETAT EST ICI, PAS DANS LE CHEMIN NOMINAL. Elle etait
// apres la boucle : une exception au rechiffrement ou au PUT la
// sautait, et la ligne restait sur « Saving... » pour toujours - sans
// message, puisque le message aussi etait dans la partie sautee.
// Quoi qu'il arrive au-dessus, l'ecran redevient utilisable.
TThread.Queue(nil,
procedure
begin
SetBusy(False);
ReopenEntryByUuid(LUuid);
end);
end;
end).Start;
end;