Well, at the moment, question_process_responses in questionlib.php can return true of false to indicate success/failure, as can default_questiontype::grade_responses. However, question_process_responses ingores the return value of default_questiontype::grade_responses, and mod/quiz/attempt.php and question/preview.php ignore the return code from question_process_responses.
I need to put in the necessary error handling.