Ignoring failed event notifications
These happen rarely and are not a big deal when they do. We still log them to the Vim message area, but we don't annoy the user with the default, in-your-face Python traceback.
This commit is contained in:
parent
17716ff51f
commit
9a4707f2c6
@ -17,6 +17,8 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
|
import traceback
|
||||||
|
from ycm import vimsupport
|
||||||
from ycm.client.base_request import BaseRequest, BuildRequestData
|
from ycm.client.base_request import BaseRequest, BuildRequestData
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +35,15 @@ class EventNotification( BaseRequest ):
|
|||||||
request_data.update( self._extra_data )
|
request_data.update( self._extra_data )
|
||||||
request_data[ 'event_name' ] = self._event_name
|
request_data[ 'event_name' ] = self._event_name
|
||||||
|
|
||||||
self.PostDataToHandler( request_data, 'event_notification' )
|
# On occasion, Vim tries to send event notifications to the server before
|
||||||
|
# it's up. This causes intrusive exception messages to interrupt the user.
|
||||||
|
# While we do want to log these exceptions just in case, we post them
|
||||||
|
# quietly to the Vim message log because nothing bad will happen if the
|
||||||
|
# server misses some events and we don't want to annoy the user.
|
||||||
|
try:
|
||||||
|
self.PostDataToHandler( request_data, 'event_notification' )
|
||||||
|
except:
|
||||||
|
vimsupport.EchoText( traceback.format_exc() )
|
||||||
|
|
||||||
|
|
||||||
def SendEventNotificationAsync( event_name, extra_data = None ):
|
def SendEventNotificationAsync( event_name, extra_data = None ):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user