Debugging: throw new typeError not showing up in Firebug
I wrote a little testscript which works for me:
// ==UserScript==
// @name Test
// @namespace TobbetestTestscript
// @include https://greasyfork.org/de/forum/discussion/*
// @version 1
// @grant none
// ==/UserScript==
try {
throw new Error('Foo Bar');
} catch(exception) {
console.log(exception);
}
Also if I set the grant to unsafeWindow everything works fine and I see the error. So it might be necessary that you can provide a (for you) non-working example.
My description wasn't very well written, I'll add an edit to clarify. However thank you for your script because it is helpful, and it does illustrate what works in my tests, so we're on common ground. Where exception fails for me is outside catch try.
I tried @grant unsafeWindow
and it didn't make much difference.
// ==UserScript== // @name exception test // @namespace ecofriend // @include https://greasyfork.org/de/forum/discussion/* // @version 1 // @grant none // ==/UserScript== console.log('exception reporting - without try catch;'); // exceptions outside try catch are reported in the browser console (not Firebug) throw new Error('food bar'); //throw new TypeError('food bar'); try { // throw new Error('food bar'); // throw new TypeError('food bar'); } catch(exception) { console.error(exception); }
I grabbed screenshots of the two scenarios; with and without try catch.
And what Firebug developers say?
I had hoped I would find the answer here.
To me it doesn't look like a Firebug bug. The normal console also does not display errors thrown by a script which are not catched. It looks more like a Greasemonkey bug to me. So I'd suggest to report it to the Greasemonkey development team: https://github.com/greasemonkey/greasemonkey
Thank you both for your input. I'll see what Greasemonkey and then Firebug have to say. I'll report back here if I find anything out.
Debugging: throw new typeError not showing up in Firebug
Firefox 36+
Greasemonkey 3.0
I apologise if this has already been discussed, I have used Greasy Fork and Google search across the internet and they turned up nothing of relevance.
When scripting I use
try catch
andthrow new Error
. However for some period of time, the output of those exceptions have only been visible in the browser console (Ctrl+Shift J) and not in Firebug console (Show JavaScript Errors checked). I get every other type ofconsole.log
message in both, just not the exceptions.Does anyone know how to get exceptions showing up in Firebug please?
EDIT: What I meant to say is: exceptions caught with try catch are reported in both browser and Firebug, however exceptions generated outside of try catch are only reported in the browser console, not Firebug