Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » using instanceof in javascript
using instanceof in javascript [message #545369] Wed, 07 July 2010 14:27 Go to next message
Zohar Amir is currently offline Zohar AmirFriend
Messages: 419
Registered: July 2009
Senior Member
Hello,
I started using eclipse to develop with javascript (actually it's JSFL, but it's close enough). I used exceptions in my code and eclipse flagged my syntax as wrong:

try {
// code here
} catch (e if e instanceof MyException) {
// handle exception
}

I found this syntax in Mozilla's site

What's wrong?

Thanks,
Zohar.
Re: using instanceof in javascript [message #545536 is a reply to message #545369] Thu, 08 July 2010 08:12 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

On 7/7/2010 10:27 AM, Zohar Amir wrote:
> Hello,
> I started using eclipse to develop with javascript (actually it's JSFL,
> but it's close enough). I used exceptions in my code and eclipse flagged
> my syntax as wrong:
>
> try {
> // code here
> } catch (e if e instanceof MyException) {
> // handle exception
> }
>
> I found this syntax in
> https://developer.mozilla.org/en/Core_JavaScript_1.5_Referen ce/Statements/try...catch
>
>
> What's wrong?
>
> Thanks,
> Zohar.

How "close enough" is it really? I don't know JSFL, but does it also
document this construct as supported?

--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: using instanceof in javascript [message #545595 is a reply to message #545536] Thu, 08 July 2010 11:10 Go to previous messageGo to next message
Zohar Amir is currently offline Zohar AmirFriend
Messages: 419
Registered: July 2009
Senior Member
Well, this construct works when I run it...
It's just that it's flagged as a syntax error by eclipse.
I'm new to using javascript - isn't this construct something normal?

Thanks,
Zohar
Re: using instanceof in javascript [message #546999 is a reply to message #545595] Wed, 14 July 2010 21:52 Go to previous messageGo to next message
John J. Barton is currently offline John J. BartonFriend
Messages: 311
Registered: July 2009
Senior Member
Zohar Amir wrote:
> Well, this construct works when I run it... It's just that it's flagged
> as a syntax error by eclipse.
> I'm new to using javascript - isn't this construct something normal?

Note that the page you cite
https://developer.mozilla.org/en/Core_JavaScript_1.5_Referen ce/Statements/try...catch

says about conditional catch:

Note: This functionality is not part of the ECMAScript specification.

So I guess eclipse does not support it. (I've never seen it used).

jjb

>
> Thanks,
> Zohar
Re: using instanceof in javascript [message #547518 is a reply to message #546999] Sun, 18 July 2010 06:37 Go to previous message
Zohar Amir is currently offline Zohar AmirFriend
Messages: 419
Registered: July 2009
Senior Member
Hello John,
You're right of course, I just guessed Mozilla is a strong enough player to support this syntax, that they use.

Thank you for looking into this.
Zohar.
Previous Topic:[Web Service using WTP] HELP: error whit WebService wizard
Next Topic:Does WTP WSDL editor allow adding new tabs? If yes how?
Goto Forum:
  


Current Time: Fri Apr 19 20:15:36 GMT 2024

Powered by FUDForum. Page generated in 0.03070 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top