Get the server response from a |future| object and catch any exception while doing so. If an exception is raised because of a unknown .ycm_extra_conf.py file, load the file or ignore it after asking the user. An identical request should be sent again to the server. For other exceptio
( self,
future,
display_message = True,
truncate_message = False )
| 61 | |
| 62 | |
| 63 | def HandleFuture( self, |
| 64 | future, |
| 65 | display_message = True, |
| 66 | truncate_message = False ): |
| 67 | """Get the server response from a |future| object and catch any exception |
| 68 | while doing so. If an exception is raised because of a unknown |
| 69 | .ycm_extra_conf.py file, load the file or ignore it after asking the user. |
| 70 | An identical request should be sent again to the server. For other |
| 71 | exceptions, log the exception and display its message to the user on the Vim |
| 72 | status line. Unset the |display_message| parameter to hide the message from |
| 73 | the user. Set the |truncate_message| parameter to avoid hit-enter prompts |
| 74 | from this message.""" |
| 75 | try: |
| 76 | try: |
| 77 | return _JsonFromFuture( future ) |
| 78 | except UnknownExtraConf as e: |
| 79 | if vimsupport.Confirm( str( e ) ): |
| 80 | _LoadExtraConfFile( e.extra_conf_file ) |
| 81 | else: |
| 82 | _IgnoreExtraConfFile( e.extra_conf_file ) |
| 83 | self._should_resend = True |
| 84 | except URLError as e: |
| 85 | # We don't display this exception to the user since it is likely to happen |
| 86 | # for each subsequent request (typically if the server crashed) and we |
| 87 | # don't want to spam the user with it. |
| 88 | _logger.error( e ) |
| 89 | |
| 90 | except Exception as e: |
| 91 | _logger.exception( 'Error while handling server response' ) |
| 92 | if display_message: |
| 93 | DisplayServerException( e, truncate_message ) |
| 94 | |
| 95 | return None |
| 96 | |
| 97 | |
| 98 | # This method blocks |
no test coverage detected