diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-07 16:04:19 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-07 16:04:19 +0200 |
commit | 334819fcd5c0c5d060d9289b235cf61b4299f17f (patch) | |
tree | 6d9c86be2af439d96274afe615e1fd057f1eca75 | |
parent | 3089666bb7c54ba915b5207f3e03e6c03fb8727d (diff) |
better error reporting of extractor
-rw-r--r-- | lib/JWebmail/Model/ReadMails/QMailAuthuser.pm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm index 311860c..19f8b12 100644 --- a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm +++ b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm @@ -211,21 +211,21 @@ sub read_qmauth { my $input = <$reader>; - my $rc; + my $rs; if (eof $reader) { # for regular open close $reader or warn "closing read pipe failed: $!"; - $rc = $? >> 8; + $rs = $?; # for IPC::Open2 if (waitpid($pid, 0) == $pid) { - $rc = $? >> 8; + $rs = $?; } } - my $resp; - if (!defined $rc) { + my ($resp, $rc); + if (!defined $rs) { my ($r, $e); eval { $r = decode_json $input; 1 } or do { @@ -242,18 +242,18 @@ sub read_qmauth { $resp = { head => $r, body => $buf, - rc => $rc, + rc => $?, e => $e, }; } - elsif ($rc == 3 || $rc == 0) { + elsif ($rs == 3 << 8 || $rs == 0) { eval { $resp = decode_json $input if $input; 1 } or do { $resp = { info => "error decoding response", response => $input, cause => $@, - return_code => $rc, + return_code => $rs >> 8, }; $rc = 3; }; |