Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #17738

Re: To catch an exception

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!news2.arglkargh.de!news.karotte.org!uucp.gnuu.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <1393459.e97MPUDCx7@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Mon, 17 Dec 2012 15:25:18 +0100
User-Agent KNode/4.4.11
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: To catch an exception
Newsgroups comp.lang.javascript
References <50cedccc$0$6950$e4fe514c@news2.news.xs4all.nl> <XnsA12CAE7AFCC69jj@0.0.0.15> <50cf22cc$0$6847$e4fe514c@news2.news.xs4all.nl>
Followup-To comp.lang.javascript
MIME-Version 1.0
Lines 59
NNTP-Posting-Date 17 Dec 2012 15:25:20 CET
NNTP-Posting-Host ef5d72b1.newsspool3.arcor-online.net
X-Trace DXC=AWoh9k\<fA7QbA1[CgMQ00McF=Q^Z^V384Fo<]lROoR18kF<OcfhCO;lR2`G9JAm;0DZm8W4\YJN<b@mF9jNikd5oJ>hYTWd=k8HTTRcBC<W]1
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:17738

Followups directed to: comp.lang.javascript

Show key headers only | View raw


Tom de Neef wrote:

> "JJ" <jaejunks@nah.meh> schreef […]
>> "Tom de Neef" <tdeneef@qolor.nl> wrote:
>>> Can someone indicate what I do wrong here:
>>> {code}
    ^^^^^^
BTW, this is unnecessary and distracting here.

>>> function removeStyleElement(scope) {
>>>   var sheets = document.styleSheets,k,sheet,rules,j,rule,s;
>>>   scope = scope.toLowerCase();
>>>   for (k=sheets.length-1;k>=0;k--) {  // skip the 'fixed' styles in
>>>   sheet[0]
>>>     sheet = sheets[k];
>>> //    try {
>>>       rules = (sheet.cssRules)?sheet.cssRules:sheet.rules;  //<<=====
>>> //    }
>>> //    catch (err) {return};
>>>     if (rules) {
>>>       for (j=0;j<rules.length;j++) {
>>>          rule = rules[j];
>>>          s = (rule.selectorText)?rule.selectorText:rule;
>>>          if (s.toLowerCase() == scope) {
>>>            if (sheet.removeRule) {sheet.removeRule(j)}
>>>            else { if (sheet.deleteRule) sheet.deleteRule(j) };
>>>          }
>>>       }
>>>     }
>>>   }
>>> }
>>> […]
>> 
>> The statement in the disabled try...catch shouldn't cause problem. What's
>> the exact exception error message when it occurs?
> 
> There is no error message. When FF reaches that line, it jumps out and
> stops execution (doesn't pick up in an enclosing block).

Highly unlikely.

> With the try .. catch included, it will jump to the catch statement. But I
> do not know how to get information from the 'err' object.

By inspecting it?  By document.write()ing, window.alert()ing, 
console.log()ing it before you return?

> The debugger doesn't show it.

It should, and it does, unless its not showing it is related to your bad 
code style (you have the “catch” keyword, its /Block/ statement, and the 
“return” statement in the block on the same line).


PointedEars
-- 
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
  -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

To catch an exception "Tom de Neef" <tdeneef@qolor.nl> - 2012-12-17 09:50 +0100
  Re: To catch an exception Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-17 10:44 +0100
    Re: To catch an exception JJ <jaejunks@nah.meh> - 2012-12-17 10:07 +0000
    Re: To catch an exception "Tom de Neef" <tdeneef@qolor.nl> - 2012-12-17 15:23 +0100
      Re: To catch an exception Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-17 15:33 +0100
        Re: To catch an exception John G Harris <john@nospam.demon.co.uk> - 2012-12-17 15:28 +0000
          Re: To catch an exception Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-17 17:32 +0100
            Re: To catch an exception John G Harris <john@nospam.demon.co.uk> - 2012-12-18 17:01 +0000
              Re: To catch an exception Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-29 14:41 +0100
                Re: To catch an exception Dr J R Stockton <reply1252@merlyn.demon.co.uk.invalid> - 2012-12-30 16:23 +0000
            Re: To catch an exception Dr J R Stockton <reply1251@merlyn.demon.co.uk.invalid> - 2012-12-18 16:35 +0000
              Re: To catch an exception Andrew Poulos <ap_prog@hotmail.com> - 2012-12-19 22:15 +1100
      Re: To catch an exception Patricia Shanahan <pats@acm.org> - 2012-12-17 07:18 -0800
  Re: To catch an exception JJ <jaejunks@nah.meh> - 2012-12-17 10:04 +0000
    Re: To catch an exception "Tom de Neef" <tdeneef@qolor.nl> - 2012-12-17 14:48 +0100
      Re: To catch an exception Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-17 15:25 +0100
  Re: To catch an exception Tim Streater <timstreater@greenbee.net> - 2012-12-17 16:03 +0000
  Re: To catch an exception Scott Sauyet <scott.sauyet@gmail.com> - 2012-12-18 08:26 -0800
  Re: To catch an exception Bart Van der Donck <bart@nijlen.com> - 2012-12-30 08:42 -0800

csiph-web