Skip to content

Commit

Permalink
Capture ValueError along with ImportError
Browse files Browse the repository at this point in the history
For issue #168
It appears the new relative imports I was using was throwing an
unexpected error in ST2 and breaking.

In the future I should probably not use Error handling for flow control
like this and just determin the ST version and then use the appropriate
import method.
  • Loading branch information
jisaacks committed May 30, 2014
1 parent ef6080f commit f6aaac4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion git_gutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sublime_plugin
try:
from .view_collection import ViewCollection
except ImportError:
except (ImportError, ValueError):
from view_collection import ViewCollection


Expand Down
2 changes: 1 addition & 1 deletion git_gutter_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sublime_plugin
try:
from .view_collection import ViewCollection
except ImportError:
except (ImportError, ValueError):
from view_collection import ViewCollection


Expand Down
2 changes: 1 addition & 1 deletion git_gutter_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
try:
from . import git_helper
from .view_collection import ViewCollection
except ImportError:
except (ImportError, ValueError):
import git_helper
from view_collection import ViewCollection

Expand Down
4 changes: 2 additions & 2 deletions view_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class ViewCollection:
def add(view):
key = ViewCollection.get_key(view)
try:
from GitGutter.git_gutter_handler import GitGutterHandler
except ImportError:
from .git_gutter_handler import GitGutterHandler
except (ImportError, ValueError):
from git_gutter_handler import GitGutterHandler
handler = ViewCollection.views[key] = GitGutterHandler(view)
handler.reset()
Expand Down

0 comments on commit f6aaac4

Please sign in to comment.