-
-
Notifications
You must be signed in to change notification settings - Fork 91
Properly handle exception from missing vscode config json file #2728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3b9d917
fd9bea0
81d5a5b
0bad81a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -153,7 +153,12 @@ def setup_hat_styles_csv(hat_colors: dict[str, str], hat_shapes: dict[str, str]) | |||||||||||||||||||||||||||||||||
def init_hats(hat_colors: dict[str, str], hat_shapes: dict[str, str]): | ||||||||||||||||||||||||||||||||||
setup_hat_styles_csv(hat_colors, hat_shapes) | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
vscode_settings_path: Path = actions.user.vscode_settings_path().resolve() | ||||||||||||||||||||||||||||||||||
vscode_settings_path: Path | None = None | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
try: | ||||||||||||||||||||||||||||||||||
vscode_settings_path = actions.user.vscode_settings_path().resolve() | ||||||||||||||||||||||||||||||||||
except Exception as ex: | ||||||||||||||||||||||||||||||||||
print(ex) | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the exception that was uncaught and broke Cursorless logic further up the call stack.
Comment on lines
+158
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to avoid just doing raw printing of exception objects, because then you see the exception message in the log without much context / able to debug them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exception message is already well formed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's defined here cursorless/cursorless-talon/src/apps/vscode_settings.py Lines 66 to 73 in 0bad81a
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
def on_watch(path, flags): | ||||||||||||||||||||||||||||||||||
global fast_reload_job, slow_reload_job | ||||||||||||||||||||||||||||||||||
|
@@ -166,10 +171,12 @@ def on_watch(path, flags): | |||||||||||||||||||||||||||||||||
"10s", lambda: setup_hat_styles_csv(hat_colors, hat_shapes) | ||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
fs.watch(str(vscode_settings_path), on_watch) | ||||||||||||||||||||||||||||||||||
if vscode_settings_path is not None: | ||||||||||||||||||||||||||||||||||
fs.watch(vscode_settings_path, on_watch) | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
def unsubscribe(): | ||||||||||||||||||||||||||||||||||
fs.unwatch(str(vscode_settings_path), on_watch) | ||||||||||||||||||||||||||||||||||
if vscode_settings_path is not None: | ||||||||||||||||||||||||||||||||||
fs.unwatch(vscode_settings_path, on_watch) | ||||||||||||||||||||||||||||||||||
if unsubscribe_hat_styles is not None: | ||||||||||||||||||||||||||||||||||
unsubscribe_hat_styles() | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just created a lot of noise in the Talon log. We know were the problem is without this.