Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #25489 > unrolled thread
| Started by | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| First post | 2014-07-21 10:23 +1000 |
| Last post | 2014-07-21 05:09 -0700 |
| Articles | 5 — 5 participants |
Back to article view | Back to comp.lang.javascript
Nested try catch Andrew Poulos <ap_prog@hotmail.com> - 2014-07-21 10:23 +1000
Re: Nested try catch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-21 03:58 +0200
Re: Nested try catch Joao Rodrigues <groups_jr-1@yahoo.com> - 2014-07-21 00:19 -0300
Re: Nested try catch Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2014-07-21 08:37 +0200
Re: Nested try catch "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-07-21 05:09 -0700
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2014-07-21 10:23 +1000 |
| Subject | Nested try catch |
| Message-ID | <7rSdna_x9Z-mw1HOnZ2dnUVZ_vWdnZ2d@westnet.com.au> |
If I have this
try {
// blah
} catch(e) {
try {
// blah 2
} catch(e) {}
}
jslint.com says "'e' is already defined" - fair enough. But if I change
it to
try {
// blah
} catch(e) {
try {
// blah 2
} catch(e2) {}
}
jslint.com says "Expected 'ignore' and instead saw 'e2'".
Is 'ignore' just a variable name that jslint.com prefers?
Andrew Poulos
[toc] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-07-21 03:58 +0200 |
| Message-ID | <2060326.l3rICqCpkh@PointedEars.de> |
| In reply to | #25489 |
Andrew Poulos wrote:
> If I have this
>
> try {
> // blah
> } catch(e) {
> try {
> // blah 2
> } catch(e) {}
> }
>
> jslint.com says "'e' is already defined" - fair enough. But if I change
> it to
>
> try {
> // blah
> } catch(e) {
> try {
> // blah 2
> } catch(e2) {}
> }
>
> jslint.com says "Expected 'ignore' and instead saw 'e2'".
>
> Is 'ignore' just a variable name that jslint.com prefers?
Given that jslint.com reports identifiers that are clearly block-scoped per
Specification as global variables, I would not put too much weight on what
jslint.com has to say.
This is just one of jslint.com’s many idiosyncrasies imposing Douglas
Crockford’s defective perception of ECMAScript and its implementations on
developers: If the “catch” block is empty (not considering comments), he/it
expects the identifier for the exception value to be “ignore”, and anything
else is considered an error; otherwise the identifier “ignore” is considered
an error.
ISTM that jslint.com checks grow more rediculous by the year. Perhaps
Douglas Crockford cares to explain what is so bad about block code indented
with two spaces instead of four? I would not mind making additional checks
optional, but to make them the default is highly presumptuous of him.
My advice: Just ignore the new Crockford, his books, and jslint.com.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Joao Rodrigues <groups_jr-1@yahoo.com> |
|---|---|
| Date | 2014-07-21 00:19 -0300 |
| Message-ID | <lqi0rg$42v$1@speranza.aioe.org> |
| In reply to | #25489 |
On 07/20/2014 09:23 PM, Andrew Poulos wrote:
> If I have this
>
> try {
> // blah
> } catch(e) {
> try {
> // blah 2
> } catch(e) {}
> }
>
> jslint.com says "'e' is already defined" - fair enough.
Maybe this is due to an old problem with the try...catch block in IE 8
and earlier.
> But if I change
> it to
>
> try {
> // blah
> } catch(e) {
> try {
> // blah 2
> } catch(e2) {}
> }
>
> jslint.com says "Expected 'ignore' and instead saw 'e2'".
>
> Is 'ignore' just a variable name that jslint.com prefers?
Yes, "ignore" is meant to be used as one of the "Crockfordian"
assumptions. See the 'ignore' check in the jslint code:
<https://github.com/douglascrockford/JSLint/blob/master/jslint.js>
<http://stackoverflow.com/questions/16613790/jslint-error-expected-ignore-and-instead-saw-ex>
--
Joao Rodrigues
[toc] | [prev] | [next] | [standalone]
| From | Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> |
|---|---|
| Date | 2014-07-21 08:37 +0200 |
| Message-ID | <56dps9lg2e66m6dirstdl7og4j2gq6gulc@4ax.com> |
| In reply to | #25489 |
On Mon, 21 Jul 2014 10:23:40 +1000, Andrew Poulos wrote:
>try {
> // blah
>} catch(e) {
> try {
> // blah 2
> } catch(e2) {}
>}
>
>jslint.com says "Expected 'ignore' and instead saw 'e2'".
>
>Is 'ignore' just a variable name that jslint.com prefers?
Yes. My thought on this is that it is not a bad idea to call the
ignored exception 'ignore'. I do that in my programming as well,
have done it already before learning that jslint likes it too.
But it is only a recommendation. You don't have to follow it.
Hans-Georg
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2014-07-21 05:09 -0700 |
| Message-ID | <8733ef78-b8fe-410c-9941-94daaa481eed@googlegroups.com> |
| In reply to | #25489 |
On Sunday, July 20, 2014 7:23:40 PM UTC-5, Andrew Poulos wrote:
> If I have this
>
> try {
> // blah
> } catch(e) {
> try {
> // blah 2
> } catch(e) {}
> }
>
> jslint.com says "'e' is already defined" - fair enough. But if I change
> it to
>
> try {
> // blah
> } catch(e) {
> try {
> // blah 2
> } catch(e2) {}
> }
>
> jslint.com says "Expected 'ignore' and instead saw 'e2'".
> Is 'ignore' just a variable name that jslint.com prefers?
use jshint.com instead
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web