GPG show error on view/export

This commit is contained in:
the-djmaze 2024-03-04 11:15:34 +01:00
parent d57300dd75
commit 5aa71a3ede
2 changed files with 4 additions and 3 deletions

View file

@ -97,6 +97,7 @@ export const GnuPGUserStore = new class {
} }
} catch (e) { } catch (e) {
Passphrases.delete(key); Passphrases.delete(key);
alert(e.message);
} }
} }
return key.armor; return key.armor;

View file

@ -1114,9 +1114,9 @@ class PGP extends Base implements \SnappyMail\PGP\PGPInterface
foreach ($this->_openPipes->readPipeLines(self::FD_ERROR) as $line) { foreach ($this->_openPipes->readPipeLines(self::FD_ERROR) as $line) {
$this->_debug("\t{$line}"); $this->_debug("\t{$line}");
$errors[] = \preg_replace('/^gpg: /', '', $line); $errors[] = \preg_replace('/^gpg: /', '', $line);
if ($throw && (\str_contains($line, 'error') || \str_contains($line, 'failed'))) {
break 2;
} }
if ($throw && $errors) {
break;
} }
} }