From 63c5daac64ecc8f522b449b4008cd3b50286e281 Mon Sep 17 00:00:00 2001 From: Gabriel Birke Date: Mon, 21 Oct 2024 10:52:21 +0200 Subject: [PATCH] Improve exception messages This commit disambiguates the exception messages when getting a donation. When a donation can be loaded but the conversion to a domain object fails, the message no longer reads "could not get donation" (that would hint at the donation not being in the database). Ticket: https://phabricator.wikimedia.org/T375196 --- src/DataAccess/DoctrineDonationRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DataAccess/DoctrineDonationRepository.php b/src/DataAccess/DoctrineDonationRepository.php index 7d25e5cd..7043680e 100644 --- a/src/DataAccess/DoctrineDonationRepository.php +++ b/src/DataAccess/DoctrineDonationRepository.php @@ -113,7 +113,7 @@ public function getDonationById( int $id ): ?Donation { try { return $converter->createFromLegacyObject( $doctrineDonation ); } catch ( \InvalidArgumentException $ex ) { - throw new GetDonationException( $ex, "Could not get donation with id '$id'" ); + throw new GetDonationException( $ex, "Could not convert donation with id '$id' - " . $ex->getMessage() ); } } }