Ignoring the new "already being parsed" message

This exception comes from ycmd and is not something the user can do
anything about, so let's rather not show it.
This commit is contained in:
Strahinja Val Markovic 2014-12-09 15:22:58 -08:00
parent 995e6be437
commit 2fafab88c4
3 changed files with 15 additions and 5 deletions

View File

@ -163,6 +163,16 @@ def JsonFromFuture( future ):
return None return None
def HandleServerException( exception ):
serialized_exception = str( exception )
# We ignore the exception about the file already being parsed since it comes
# up often and isn't something that's actionable by the user.
if 'already being parsed' in serialized_exception:
return
vimsupport.PostVimMessage( serialized_exception )
def _ValidateResponseObject( response ): def _ValidateResponseObject( response ):
if not utils.ContentHexHmacValid( if not utils.ContentHexHmacValid(
response.content, response.content,

View File

@ -17,9 +17,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>. # along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
from ycm import vimsupport
from ycmd.utils import ToUtf8IfNeeded from ycmd.utils import ToUtf8IfNeeded
from ycm.client.base_request import BaseRequest, JsonFromFuture from ycm.client.base_request import ( BaseRequest, JsonFromFuture,
HandleServerException )
TIMEOUT_SECONDS = 0.5 TIMEOUT_SECONDS = 0.5
@ -46,7 +46,7 @@ class CompletionRequest( BaseRequest ):
return _ConvertCompletionResponseToVimDatas( return _ConvertCompletionResponseToVimDatas(
JsonFromFuture( self._response_future ) ) JsonFromFuture( self._response_future ) )
except Exception as e: except Exception as e:
vimsupport.PostVimMessage( str( e ) ) HandleServerException( e )
return [] return []

View File

@ -20,7 +20,7 @@
from ycm import vimsupport from ycm import vimsupport
from ycmd.responses import UnknownExtraConf from ycmd.responses import UnknownExtraConf
from ycm.client.base_request import ( BaseRequest, BuildRequestData, from ycm.client.base_request import ( BaseRequest, BuildRequestData,
JsonFromFuture ) JsonFromFuture, HandleServerException )
class EventNotification( BaseRequest ): class EventNotification( BaseRequest ):
@ -61,7 +61,7 @@ class EventNotification( BaseRequest ):
else: else:
_IgnoreExtraConfFile( e.extra_conf_file ) _IgnoreExtraConfFile( e.extra_conf_file )
except Exception as e: except Exception as e:
vimsupport.PostVimMessage( str( e ) ) HandleServerException( e )
return self._cached_response if self._cached_response else [] return self._cached_response if self._cached_response else []