public static function initResult($res) {
		if ( !is_array($res) )
			throw new Exception('Invalid datatype. Array expected!');
		elseif ( isset($res['error']) )
			throw new Exception('Server error: '.$res['error']);
		elseif ( !isset($res['result']) )
			throw new Exception('Server returned no result: '.$res);

		return $res['result'];
	}