From: Max Semenik Date: Tue, 27 Aug 2019 02:03:09 +0000 (-0700) Subject: Add more information to exception thrown X-Git-Tag: 1.34.0-rc.0~565^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=d06baad826f3a6420ace88f7c06fdc1e30e26ffb;p=lhc%2Fweb%2Fwiklou.git Add more information to exception thrown It's not just about the preference name, because current user's properties are used for validation too. Bug: T231029 Change-Id: I268b959017bb0dce2b4295d5302a544bfa3513eb --- diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php index 001c975dbc..00c290357e 100644 --- a/includes/preferences/DefaultPreferencesFactory.php +++ b/includes/preferences/DefaultPreferencesFactory.php @@ -232,7 +232,10 @@ class DefaultPreferencesFactory implements PreferencesFactory { } elseif ( $field->validate( $globalDefault, $user->getOptions() ) === true ) { $info['default'] = $globalDefault; } else { - throw new MWException( "Global default '$globalDefault' is invalid for field $name" ); + $globalDefault = json_encode( $globalDefault ); + throw new MWException( + "Default '$globalDefault' is invalid for preference $name of user $user" + ); } }