* @package taoQtiTest */ class taoQtiTest_models_classes_QtiTestServiceException extends common_Exception implements common_exception_UserReadableException { const TEST_WRITE_ERROR = 0; const ITEM_READ_ERROR = 1; const ITEM_WRITE_ERROR = 2; const TEST_READ_ERROR = 3; /** * Create a new QtiTestServiceException object. * * @param string $message A technical infiormation message. * @param integer $code A code to explicitely identify the nature of the error. */ public function __construct($message, $code = 0) { parent::__construct($message, $code); } /** * Returns a translated human-readable message destinated to the end-user. * * @return string A human-readable message. */ public function getUserMessage() { switch ($this->getCode()) { case 3: return __("The QTI test could not be retrieved correctly."); break; case 2: return __("An item involved in the test cannot be written."); break; case 1: return __("An item involved in the test cannot be read or is not QTI compliant."); break; case 0: default: return __("The QTI-XML test could not be written correctly."); break; } } }