Skip to content

Commit

Permalink
Handle all OS errors as potentially node.js not being found
Browse files Browse the repository at this point in the history
The previous approach was trying to identify which OS errors were actually about node.js paths being improperly set, but it seems like this isn't enough for all users (e.g. chinese). Give up and treat unknown OS errors as also potentially being about node.js paths, which seems generally true

Signed-off-by: Victor Porof <[email protected]>
  • Loading branch information
victorporof committed Jul 18, 2017
1 parent 29abd10 commit 661e099
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/py/utils/script_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ def handle_node_error(err):
open_sublime_settings(window)
return None

def handle_unknown_os_error(err):
print(err)
msg = "An unhandled OS error was encountered while prettifying. This usually means Node.js was not found in the default path. Please specify the location."
if ok_cancel_dialog(msg):
open_sublime_settings(window)
return None

def handle_syntax_error(err):
print(err)
msg = "Node.js version in the default path is too old! Please download the latest version and specify the updated location."
Expand Down Expand Up @@ -106,6 +113,8 @@ def handle_output_diagnostics(output):
prettified_code, output_diagnostics = prettify(args)
except NodeNotFoundError as err:
return handle_node_error(err)
except OSError as err:
return handle_unknown_os_error(err)
except NodeSyntaxError as err:
return handle_syntax_error(err)
except NodeRuntimeError as err:
Expand Down

0 comments on commit 661e099

Please sign in to comment.