Skip to content

Commit

Permalink
Add error message when formatting #39
Browse files Browse the repository at this point in the history
  • Loading branch information
timonwong committed Mar 2, 2015
1 parent 3f20262 commit 6ce9b09
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions AStyleFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,24 @@ def run(self, edit, selection_only=False):
extra_message = e.extra_message
error_panel = ErrorMessagePanel("astyle_error_message")
error_panel.write(
"%s: An error occured while processing options: %s\n\n" % (
"%s: An error occurred while processing options: %s\n\n" % (
PLUGIN_NAME, e))
if extra_message:
error_panel.write("* %s\n" % extra_message)
error_panel.show()
return
# Options ok, format now
if selection_only:
self.run_selection_only(edit, options)
else:
self.run_whole_file(edit, options)
try:
if selection_only:
self.run_selection_only(edit, options)
else:
self.run_whole_file(edit, options)
except pyastyle.error as e:
error_panel.write(
"%s: An error occurred while formatting using astyle: %s\n\n"
% (PLUGIN_NAME, e))
error_panel.show()
return
if self._get_settings('debug', False):
log_debug('AStyle version: {0}', pyastyle.version())
log_debug('AStyle options: ' + options)
Expand Down

0 comments on commit 6ce9b09

Please sign in to comment.