partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit ecb39fef9c12a1b80e35114948882c9ac97a7ed3
parent d3ecfc6213069ef42ef8708a185dc89abf81e5af
Author: Timo A. Hummel <felicitus@felicitus.org>
Date:   Sat, 28 Apr 2018 18:34:47 +0200

Fixed exception implementation for retrieving user preferences

Diffstat:
Msrc/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php b/src/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php @@ -2,6 +2,7 @@ namespace PartKeepr\AuthBundle\Exceptions; +use PartKeepr\AuthBundle\Entity\User; use PartKeepr\CoreBundle\Exceptions\TranslatableException; /** @@ -9,8 +10,22 @@ use PartKeepr\CoreBundle\Exceptions\TranslatableException; */ class UserPreferenceNotFoundException extends TranslatableException { + private $user; + private $key; + + public function __construct(User $user, $key, $code = 0, \Throwable $previous = null) + { + $this->user = $user; + $this->key = $key; + + parent::__construct($code, $previous); + } + public function getMessageKey() { - return 'The requested user preference was not found'; + return sprintf('The requested user preference %s was not found for user %s', + $this->key, + $this->user->getUsername() + ); } }