Ticket system attachements exception handling

This commit is contained in:
OpenXE 2023-02-01 16:55:54 +01:00
parent 0eb3ba50f2
commit 9daaf58281
2 changed files with 9 additions and 2 deletions

View File

@ -161,7 +161,7 @@ class MailAttachmentData implements MailAttachmentInterface
$content = $part->getContent(); $content = $part->getContent();
if ($content === null) { // This should not be if ($content === null) { // This should not be
throw new InvalidArgumentException( throw new InvalidArgumentException(
sprintf('content is null "%s"', print_r($part,true)) sprintf('content is null "%s"', substr(print_r($part,true),1000))
); );
} }

View File

@ -593,7 +593,14 @@ class TicketImportHelper
$this->logger->debug('Importing message',['message' => $message]); $this->logger->debug('Importing message',['message' => $message]);
try {
$attachments = $message->getAttachments(); $attachments = $message->getAttachments();
}
catch (Throwable $e) {
$this->logger->error('Error while getting attachments',['exception' => $e]);
return(false);
}
$anhang = count($attachments) > 0 ? 1 : 0; $anhang = count($attachments) > 0 ? 1 : 0;
$mailacc = $this->mailAccount->getEmailAddress(); $mailacc = $this->mailAccount->getEmailAddress();
$mailaccid = $this->mailAccount->getId(); $mailaccid = $this->mailAccount->getId();