MDL-20636 Reveiw all throw statements.

This commit is contained in:
Tim Hunt 2011-02-23 16:50:09 +00:00
parent f7970e3ca7
commit 88f0eb1546
15 changed files with 56 additions and 80 deletions

View file

@ -73,7 +73,7 @@ abstract class question_behaviour {
$this->question = $qa->get_question();
$requiredclass = $this->required_question_definition_type();
if (!$this->question instanceof $requiredclass) {
throw new Exception('This behaviour (' . $this->get_name() .
throw new coding_exception('This behaviour (' . $this->get_name() .
') cannot work with this question (' . get_class($this->question) . ')');
}
}
@ -543,7 +543,7 @@ abstract class question_behaviour_with_save extends question_behaviour {
if ($this->qa->get_state()->is_finished()) {
return question_attempt::DISCARD;
} else if (!$this->qa->get_state()->is_active()) {
throw new Exception('Question is not active, cannot process_actions.');
throw new coding_exception('Question is not active, cannot process_actions.');
}
if ($this->is_same_response($pendingstep)) {

View file

@ -100,7 +100,7 @@ class qbehaviour_informationitem extends question_behaviour {
public function process_comment(question_attempt_pending_step $pendingstep) {
if ($pendingstep->has_behaviour_var('mark')) {
throw new Exception('Information items cannot be graded.');
throw new coding_exception('Information items cannot be graded.');
}
return parent::process_comment($pendingstep);
}

View file

@ -55,14 +55,14 @@ class qbehaviour_missing extends question_behaviour {
}
public function init_first_step(question_attempt_step $step) {
throw new Exception('The behaviour used for this question is not available. No processing is possible.');
throw new coding_exception('The behaviour used for this question is not available. No processing is possible.');
}
public function process_action(question_attempt_pending_step $pendingstep) {
throw new Exception('The behaviour used for this question is not available. No processing is possible.');
throw new coding_exception('The behaviour used for this question is not available. No processing is possible.');
}
public function get_min_fraction() {
throw new Exception('The behaviour used for this question is not available. No processing is possible.');
throw new coding_exception('The behaviour used for this question is not available. No processing is possible.');
}
}

View file

@ -48,7 +48,7 @@ class qbehaviour_opaque_test extends qbehaviour_walkthrough_test_base {
global $DB;
$engineid = $DB->get_field('question_opaque_engines', 'MIN(id)', array());
if (empty($engineid)) {
throw new Exception('Cannot test Opaque. No question engines configured.');
throw new coding_exception('Cannot test Opaque. No question engines configured.');
}
question_bank::load_question_definition_classes('opaque');