mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 03:09:17 +08:00
Fix logging bug in runtime
This commit is contained in:
parent
e17f556c25
commit
aa8a8f80f0
@ -111,20 +111,17 @@ export function Call(name, args, timeout) {
|
||||
* @param {string} incomingMessage
|
||||
*/
|
||||
export function Callback(incomingMessage) {
|
||||
// Decode the message - Credit: https://stackoverflow.com/a/13865680
|
||||
//incomingMessage = decodeURIComponent(incomingMessage.replace(/\s+/g, '').replace(/[0-9a-f]{2}/g, '%$&'));
|
||||
|
||||
// Parse the message
|
||||
var message;
|
||||
let message;
|
||||
try {
|
||||
message = JSON.parse(incomingMessage);
|
||||
} catch (e) {
|
||||
const error = `Invalid JSON passed to callback: ${e.message}. Message: ${incomingMessage}`;
|
||||
wails.LogDebug(error);
|
||||
runtime.LogDebug(error);
|
||||
throw new Error(error);
|
||||
}
|
||||
var callbackID = message.callbackid;
|
||||
var callbackData = callbacks[callbackID];
|
||||
let callbackID = message.callbackid;
|
||||
let callbackData = callbacks[callbackID];
|
||||
if (!callbackData) {
|
||||
const error = `Callback '${callbackID}' not registered!!!`;
|
||||
console.error(error); // eslint-disable-line
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user