File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -1300,13 +1300,16 @@ def pager(self, text):
13001300 self .focus_on_subprocess (command + [tmp .name ])
13011301
13021302 def show_source (self ):
1303- source = self .get_source_of_current_name ()
1304- if source is None :
1305- self .status_bar .message (_ ('Cannot show source.' ))
1306- else :
1303+ try :
1304+ source = self .get_source_of_current_name ()
13071305 if self .config .highlight_show_source :
1308- source = format (PythonLexer ().get_tokens (source ), TerminalFormatter ())
1306+ source = format (PythonLexer ().get_tokens (source ),
1307+ TerminalFormatter ())
13091308 self .pager (source )
1309+ except (ValueError , NameError ), e :
1310+ self .status_bar .message (_ (e ))
1311+ except (AttributeError , IOError , TypeError ), e :
1312+ self .status_bar .message (_ ('Failed to get source: %s' % e ))
13101313
13111314 def help_text (self ):
13121315 return (self .version_help_text () + '\n ' + self .key_help_text ()).encode ('utf8' )
You can’t perform that action at this time.
0 commit comments