From fede0be5de2be045fdf29b790953687935009389 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 27 Jun 2012 15:27:50 +0100 Subject: [PATCH] MDL-34065 lib: improve two debugging messages. If the string passed to get_string is empty, say that. Don't say that it contains illegal characters. When relying on the __call magic in plugin_renderer_base, when the method cannot be found, include the right class name in the error message. --- lib/moodlelib.php | 2 +- lib/outputrenderers.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 2dd1f58addf..16db6c8a851 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -7179,7 +7179,7 @@ function get_string($identifier, $component = '', $a = NULL, $lazyload = false) $identifier = clean_param($identifier, PARAM_STRINGID); if (empty($identifier)) { - throw new coding_exception('Invalid string identifier. Most probably some illegal character is part of the string identifier. Please fix your get_string() call and string definition'); + throw new coding_exception('Invalid string identifier. The identifier cannot be empty. Please fix your get_string() call.'); } // There is now a forth argument again, this time it is a boolean however so diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 1d1660366a2..ea0f784aaa7 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -228,12 +228,12 @@ class plugin_renderer_base extends renderer_base { */ public function __call($method, $arguments) { if (method_exists('renderer_base', $method)) { - throw new coding_exception('Protected method called against '.__CLASS__.' :: '.$method); + throw new coding_exception('Protected method called against '.get_class($this).' :: '.$method); } if (method_exists($this->output, $method)) { return call_user_func_array(array($this->output, $method), $arguments); } else { - throw new coding_exception('Unknown method called against '.__CLASS__.' :: '.$method); + throw new coding_exception('Unknown method called against '.get_class($this).' :: '.$method); } } }