1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 19:33:07 +01:00

Log fetch exceptions to activity log

This commit is contained in:
FreeScout 2019-11-13 23:30:20 -08:00
parent 0b4f4f915a
commit 5fbcf19389
2 changed files with 20 additions and 0 deletions

View File

@ -765,6 +765,18 @@ class Helper
->log($description);
}
/**
* Log exception to activity log.
*/
public static function logExceptionToActivityLog($e, $log_name, $description, $properties = [])
{
$properties['error'] = self::formatException($e);
activity()
->withProperties($properties)
->useLog($log_name)
->log($description);
}
/**
* Check if folder is writable.
*

View File

@ -396,6 +396,10 @@ class Message
} catch (\Exception $_e) {
$this->date = Carbon::now();
\Helper::logException($_e, '[Webklex\IMAP\Message]');
\Helper::logExceptionToActivityLog($_e,
\App\ActivityLog::NAME_EMAILS_FETCHING,
\App\ActivityLog::DESCRIPTION_EMAILS_FETCHING_ERROR
);
//throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e);
}
}
@ -831,6 +835,10 @@ class Message
return $this->convertEncoding($str, $from, $to);
} else {
\Helper::logException($e, '[Webklex\IMAP\Message]');
\Helper::logExceptionToActivityLog($e,
\App\ActivityLog::NAME_EMAILS_FETCHING,
\App\ActivityLog::DESCRIPTION_EMAILS_FETCHING_ERROR
);
return $str;
}
}