Open adamlui opened 3 weeks ago
I fixed the throwing by updating consoleErr()
to:
function consoleErr(label, msg) {
console.error( `${config.appSymbol} ${config.appName} » ${
typeof label == 'object' ? JSON.stringify(label) : label }${ msg ? `: ${msg}` : ''}`)
}
... but it's still nice how VM auto-converts, also for some reason their obj is much more detailed
TM:
VM:
Will be fixed at the next BETA version. Thanks for reporting.
Out of curiosity, the following test script is always logging [object Object]
here. With no browser or script manager I get the stringified object logged.
// ==UserScript==
// @name 234234.example.com
// @namespace http://tampermonkey.net/
// @version 2024-08-29
// @description try to take over the world!
// @author You
// @match https://*/*
// @grant GM.xmlHttpRequest
// @connect example.com
// ==/UserScript==
function consoleErr(label, msg) { console.error(`aa bb » ${label}${ msg ? `: ${msg}` : '' }`)}
GM.xmlHttpRequest({
method: "GET",
url: "https://234234.example.com",
onerror: function(e) {
consoleErr(e);
}
});
What's no browser or script manager mean? Also the code in FF TM shows the original TypeError to me
You said "in Violentmonkey it does not throw + properly logs the err obj". What does "properly" mean? I only get the string [object Object]
being logged.
You said "in Violentmonkey it does not throw + properly logs the err obj". What does "properly" mean? I only get the string
[object Object]
being logged.
I get the pic I pasted
Also my code is:
onerror: err => { log.err(err)
if (!config.proxyAPIenabled) appAlert(!config.openAIkey ? 'login' : ['openAInotWorking', 'suggestProxy'])
else if (get.reply.status != 'done') api.tryNew(get.reply)
}
... and I notice on error, it logs only, the next 2 lines don't run
When I simplify the onerror to just api.tryNew(get.reply) it works though
I figured it out, the stream is considered done by the reader on error so i removed the condition
Should be fixed at 5.3.6209 (crx|xpi in review)
Please download the crx file linked above and drag and drop it to the extensions page chrome://extensions
(after you've enabled 'Developer Mode').
For a quick fix please export your settings and scripts as zip or (JSON) file at the "Utilities" tab and import it back at the fixed BETA version.
(Please fill out the issue template with your details)
Expected Behavior
Log the error, do not throw
Actual Behavior
Uncaught TypeError: can't convert label to string
Specifications
Script
(Please give an example of the script if applicable.)
The above on error will throw unless
err
is wrapped inJSON.stringify()
(In Violentmonkey it does not throw + properly logs the
err
obj and script healthily keeps on running)Maybe related to https://github.com/Tampermonkey/tampermonkey/issues/1877