message MDL-25114 tried to provide a more helpful error message for when code sending a message supplied an unknown component or event name

This commit is contained in:
Andrew Davis 2010-11-09 06:01:20 +00:00
parent c8fdd86791
commit 60dd7688a8
2 changed files with 7 additions and 0 deletions

View file

@ -115,6 +115,12 @@ function message_send($eventdata) {
print_error('cannotsavemessageprefs', 'message');
}
$processor = get_user_preferences($preferencename, NULL, $eventdata->userto->id);
if (empty($processor)) {
//this means they supplied an $eventdata->component $eventdata->name combination which doesn't
//exist in the message_provider table
$preferrormsg = get_string('couldnotfindpreference', 'message', $preferencename);
throw new coding_exception($preferrormsg);
}
}
if ($processor=='none' && $savemessage->notification) {