Skip to content

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

Open
1j01 wants to merge 1 commit intoparro-it:masterfrom
1j01:patch-1
Open

Prevent caught error when using register(accelerator, callback) signature#107
1j01 wants to merge 1 commit intoparro-it:masterfrom
1j01:patch-1

Conversation

@1j01
Copy link
Copy Markdown

@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.

1 participant