'There was error inserting data into the database.', E_VROOM_EXECUTE_QUERY_FAILED => 'There was an error executing the query.', E_VROOM_PREPARE_QUERY_FAILED => 'Mysqli had problems with preparing the statement to send to DB.', E_VROOM_LOAD_RECV_PRI_KEY_FAILED => 'There was an error loading private key to decrypt data.', E_VROOM_LOAD_SEND_PUB_KEY_FAILED => 'Loading public key to encrypt data before sending to iPad... failed. Anyway, what\'s up?', E_VROOM_INVALID_FUNCTION_CALL => 'An invalid function call was made. Expected number of parameters were not delivered.', E_VROOM_DB_CONNECT_FAILED => 'Could not connect to the database with the given credentials.', E_VROOM_LOGIN_FAILED => 'ACCESS_DENIED', ); class ErrorObject { public $errorCode; public $errorDescription; private $_config; function __construct($communicationObject, $errorCode, $errorDescription = '') { global $allErrorDescriptions; $this->errorCode = $errorCode; if($errorDescription != '') $this->errorDescription = $errorDescription; else $this->errorDescription = $allErrorDescriptions[$errorCode]; $this->_config = new Config(); $this->LogError($communicationObject, $errorCode); } private function LogError($commObj, $errorCode) { if(!$this->_config->IsSavingErrorToDbEnabled()) { return; } $request = $commObj instanceof RequestObject? $commObj->ToJSONString() : $commObj; if($errorCode == E_VROOM_DB_CONNECT_FAILED) { //TODO: Log $request to file or server's error log return; } //TODO: Log $request error to DB } } ?>