'There was error inserting data into the database.', E_BJ_EXECUTE_QUERY_FAILED => 'There was an error executing the query.', E_BJ_PREPARE_QUERY_FAILED => 'Mysqli had problems with preparing the statement to send to DB.', E_BJ_LOAD_RECV_PRI_KEY_FAILED => 'There was an error loading private key to decrypt data.', E_BJ_LOAD_SEND_PUB_KEY_FAILED => 'Loading public key to encrypt data before responding... failed. Anyway, what\'s up?', E_BJ_INVALID_FUNCTION_CALL => 'An invalid function call was made. Expected number of parameters were not delivered.', E_BJ_DB_CONNECT_FAILED => 'Could not connect to the database with the given credentials.', E_BJ_LOGIN_FAILED => 'ACCESS_DENIED', E_BJ_WRONG_CARD_INIT => 'A Card cannot be initialized with null for $suit or $value', E_BJ_HAND_LOCKED => 'The hand is locked probably because you doubled down or stood on a split hand. Cannot add more cards.', E_BJ_CANNOT_SPLIT => 'Cannot split hand.', E_BJ_NO_NAME => 'Player name not provided.', E_BJ_NO_ACTIVE_SESSION => 'An active session was not found. Please try restarting the game by resending just the name.', E_BJ_MOVE_NO_HAND_ID => 'Looks like the player wants to move but has not supplied id of the hand in which to make the move.', E_BJ_MOVE_UNKNOWN => 'Unknown move.', E_BJ_HAND_BAD_INDEX => 'An attempt was made to address an invalid hand.', E_BJ_HAND_INVALID_SUM => 'Sum of cards in hand is less than 17. Please Hit more.', E_BJ_UNKNOWN_ENDGAME_STATE => 'Unhandled end game state was encountered. Please file a bug with the developer with a description of all hands on the table.', E_BJ_UNKNOWN_HAND_STATE => 'An attempt was made to set hand to an unknown state. Please contact the developer. This is probably a programming error.', E_BJ_HAND_UNPLAYABLE => 'The hand is no longer playable as the match has ended with that hand.', ); class Error { public $errorCode; public $errorDescription; private $_config; function __construct($errorCode, $errorDescription = '') { global $allErrorDescriptions; $this->errorCode = $errorCode; if($errorDescription != '') $this->errorDescription = $errorDescription; else if(array_key_exists($errorCode, $allErrorDescriptions)) $this->errorDescription = $allErrorDescriptions[$errorCode]; $this->LogError($errorCode); } private function LogError($errorCode) { $this->_config = new Config(); if(!$this->_config->logError) { return; } } }