Skip to content

Commit

Permalink
enhancement of handling MIDI input init failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Prete committed Jun 1, 2024
1 parent ba71331 commit 87d3cb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/python/spontini_server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,14 @@ def doPostSync(message, request):
log(clientInfo + traceback.format_exc(), "E")
return sendCompleteResponse("KO", traceback.format_exc().encode("utf8"))

if message['cmd'] == 'LOG':
if not checkMsgStructure(message, 2):
return sendMalformedMsgResponse()
text = message['param1']
level = message['param2']
log(clientInfo + text, level)
return sendCompleteResponse("OK", "")

if message['cmd'] == 'EXEC_PLUGIN':
if not checkMsgStructure(message, 5):
return sendMalformedMsgResponse()
Expand Down
6 changes: 5 additions & 1 deletion lib/webgui/js/midi-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ function turnOnMidiInputAndListenOnChannel(channel) {
WebMidi
.enable()
.then(onEnabled)
.catch(err => alert(err));
.catch(err => {
console.error(err)
sendMsgToSpontiniServer({ cmd: 'LOG', param1: "[MIDI input] " +
err.toString(), param2: 'E' }, function(statusTxt, responseTxt) {})
});

// Function triggered when WebMidi.js is ready
function onEnabled() {
Expand Down

0 comments on commit 87d3cb1

Please sign in to comment.