Skip to content
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

Prevent caught error when using register(accelerator, callback) signature #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

1j01
Copy link

@1j01 1j01 commented Mar 23, 2024

Before, when calling register(accelerator, callback), while shuffling the argument variables to convert from the 2-parameter to the 3-parameter signature, win was left holding the accelerator string, and this was passed to title() which expects a BrowserWindow, generating an error:

    TypeError: win.getTitle is not a function

The error was caught in title(), which returned "A destroyed window", leading (presumably) to an inaccurate debug log.

This was not a serious issue, as win was not used further, but even caught errors become a nuisance when debugging with breaking on caught exceptions enabled, since you have to skip over them each time you restart the program, to get to the errors you're interested in.

In full disclosure, I haven't tested this fix, but I'm fairly confident in it.

…nature

Before, when calling `register(accelerator, callback)`, while shuffling the argument variables to convert from the 2-parameter to the 3-parameter signature, `win` was left holding the accelerator string, and this was passed to `title()` which expects a BrowserWindow, generating an error:
    TypeError: win.getTitle is not a function
The error was caught in `title()`, which returned "A destroyed window", leading to an inaccurate debug log.

This was not a serious issue, but even caught errors become a nuisance when debugging with breaking on caught exceptions enabled, since you have to skip over them each time you restart the program, to get to the errors you're interested in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant