midi-components: Improve error reporting#2583
midi-components: Improve error reporting#2583Holzhaus wants to merge 2 commits intomixxxdj:masterfrom
Conversation
We shouldn't assume that users watch the console all the time, especially when --controllerDebug is active and the log is spammed with MIDI messages.
| if (options.number === undefined) { | ||
| print("ERROR: No hotcue number specified for new HotcueButton."); | ||
| return; | ||
| throw Error("No hotcue number specified for new HotcueButton."); |
There was a problem hiding this comment.
Who catches the exception? If Mixxx is quit, this can be a party stopper, which is a kind of no go.
There was a problem hiding this comment.
If this exception is thrown and the controller mapping does not wrap it in a try-catch-block (which would be weird), then mixxx will open a popup that a script error occurred (as we already do in other cases when the mapping throws an error, e. g. when an undefined value is called as a function).
There was a problem hiding this comment.
OK, so the party is going on in any case, right?
There was a problem hiding this comment.
IIRC yes. Only the current "codepath" is affected. So if the error is thrown in a handler, the handler will not work properly (as expected), if the error is thrown in a constructor or the init method, the error will be shown on startup. The only case where this could break if the error is thrown in the constructor of a component and the mapping is creating Objects while running. In that case the objects wouldn't be constructed and thus the handlers of these objects won't be present. But even in this case, the rest of the mapping would still be functional iirc.
There was a problem hiding this comment.
I added this code snippet to my controller mapping:
this.someButton = new components.HotcueButton({
group: "[Channel1]",
midi: [0x9F, 0x02],
});Directly after loading the controller, this message popups up:

This is much more discoverable than using print which only prints to the console when --controllerDebug is specified (and my controller output Midi clock signals so I can only see it for the fraction of a seconds before it scrolls off-screen).
|
Can we please defer all the recent controller system related PRs for 2.4? |
Why? This PR is tiny and makes sure that broken controller mappings are noticed when coding them or activating the controller, not in the middle of a set. If you just want to get the 2.3 release out ASAP, I sympathize with that, but there are actual blocking issues that we need to resolve first - most notably #2547. While waiting for responses on that PR, I thought I might fix some usability issues that were bugging me for a while. |
|
Merge? The only change is that this now causes a controller script error popup instead of an easy-to-overlook error message on the console (only shown when you passed |
|
@Be-ing ping |
|
Merge? |
|
Doesn't this depend on #2588? |
We shouldn't assume that users watch the console all the time, especially
when --controllerDebug is active and the log is spammed with MIDI
messages.