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:
+24
-8
@@ -586,6 +586,7 @@ begin
|
|||||||
LClient := TSyncClient.Create(FUrl, FToken);
|
LClient := TSyncClient.Create(FUrl, FToken);
|
||||||
LDone := False;
|
LDone := False;
|
||||||
LErr := '';
|
LErr := '';
|
||||||
|
try
|
||||||
try
|
try
|
||||||
for LAttempt := 1 to 3 do
|
for LAttempt := 1 to 3 do
|
||||||
begin
|
begin
|
||||||
@@ -652,17 +653,32 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
WebCall('PM.toast(' + JsArg('Not saved - ' + LErr) + ')');
|
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);
|
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
|
finally
|
||||||
LClient.Free;
|
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;
|
||||||
end).Start;
|
end).Start;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user