mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Log some errors for #960
This commit is contained in:
parent
27d533dd5b
commit
a5dd334b71
@ -102,12 +102,17 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
public function saveAttachmentsForModel(Model $model, ?array $files): bool
|
||||
{
|
||||
if (is_array($files)) {
|
||||
/** @var UploadedFile $entry */
|
||||
foreach ($files as $entry) {
|
||||
if (!is_null($entry)) {
|
||||
$this->processFile($entry, $model);
|
||||
}
|
||||
}
|
||||
Log::debug('Done processing uploads.');
|
||||
|
||||
return true;
|
||||
}
|
||||
Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -128,6 +133,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
if ($count > 0) {
|
||||
$msg = (string)trans('validation.file_already_attached', ['name' => $name]);
|
||||
$this->errors->add('attachments', $msg);
|
||||
Log::error($msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -194,6 +200,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
if (!in_array($mime, $this->allowedMimes)) {
|
||||
$msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]);
|
||||
$this->errors->add('attachments', $msg);
|
||||
Log::error($msg);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -215,6 +222,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
if ($size > $this->maxUploadSize) {
|
||||
$msg = (string)trans('validation.file_too_large', ['name' => $name]);
|
||||
$this->errors->add('attachments', $msg);
|
||||
Log::error($msg);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -345,6 +345,7 @@ class SingleController extends Controller
|
||||
$this->attachments->saveAttachmentsForModel($journal, $files);
|
||||
|
||||
// store the journal only, flash the rest.
|
||||
Log::debug(sprintf('Count of error messages is %d', $this->attachments->getErrors()->count()));
|
||||
if (count($this->attachments->getErrors()->get('attachments')) > 0) {
|
||||
Session::flash('error', $this->attachments->getErrors()->get('attachments'));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user