Don't throw error, report it.

This commit is contained in:
James Cole
2025-11-04 20:48:58 +01:00
parent a3eb3bb1a4
commit 0bc2d40d9b
7 changed files with 61 additions and 18 deletions

View File

@@ -95,7 +95,7 @@ class AttachmentController extends Controller
/**
* Download attachment to PC.
*
* @return LaravelResponse
* @return LaravelResponse|View
*
* @throws FireflyException
*/
@@ -121,8 +121,8 @@ class AttachmentController extends Controller
return $response;
}
throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');
$message = 'Could not find the indicated attachment. The file is no longer there.';
return view('errors.error', compact('message'));
}
/**
@@ -194,7 +194,7 @@ class AttachmentController extends Controller
*
* @throws FireflyException
*/
public function view(Attachment $attachment): LaravelResponse
public function view(Attachment $attachment): LaravelResponse|View
{
if ($this->repository->exists($attachment)) {
$content = $this->repository->getContent($attachment);
@@ -223,6 +223,7 @@ class AttachmentController extends Controller
);
}
throw new FireflyException('Could not find the indicated attachment. The file is no longer there.');
$message = 'Could not find the indicated attachment. The file is no longer there.';
return view('errors.error', compact('message'));
}
}