Try/Catch Block

Discussion in 'Javascript' started by AcidBath, Mar 13, 2006.

  1. AcidBath

    AcidBath Guest

    I am new to JavaScript and need to find out if there is a something
    like the try/catch block in visual basic?
     
    AcidBath, Mar 13, 2006
    #1
    1. Advertisements

  2. AcidBath

    Lee Guest

    AcidBath said:
    Before you get to the point where you want to use try/catch, you
    should really find yourself a manual that describes the language,
    including try/catch blocks (which are supported in new browsers,
    but not some older versions that are still in use).
     
    Lee, Mar 13, 2006
    #2
    1. Advertisements

  3. There is. And it is J(ava)Script and VB(Script).NET that implement
    this exception handling syntax AFAIK introduced with Java. RTFM.


    PointedEars
     
    Thomas 'PointedEars' Lahn, Mar 13, 2006
    #3
  4. C++ had it first, although Ada has something similar. Java introduced
    the finally option.

    --
    John W. Kennedy
    "But now is a new thing which is very old--
    that the rich make themselves richer and not poorer,
    which is the true Gospel, for the poor's sake."
    -- Charles Williams. "Judgement at Chelmsford"
     
    John W. Kennedy, Mar 14, 2006
    #4
  5. Are you sure? AFAIK and according to Wikipedia, exceptions were only a
    late addition to C++.


    PointedEars
     
    Thomas 'PointedEars' Lahn, Mar 14, 2006
    #5
  6. Late compared to other things, and late in being widely implemented, but
    I know I wrote my first Java code back in the 1.0 days (1996 or so), and
    I recognized "try/catch" as being derived from C++ at that time.

    And, on looking matters up, I find that, in fact, exceptions were
    accepted into C++ in 1990, when Java was still an internal research
    project at Sun (named, at one point, C++--).

    As I say, Ada had something quite similar even earlier, but since Ada
    (like ALGOL, PL/I, or Pascal) has nested procedures/functions/blocks,
    the exception specifications were tied to them, whereas C++, lacking
    those constructs, had to invent the /try/ keyword to delimit the range
    in which an exception may be caught. Other languages have exceptions,
    but Ada is the earliest one that I personally know of in which
    exceptions are carried in programmer-defined objects, with arbitrary
    attributes.

    --
    John W. Kennedy
    "But now is a new thing which is very old--
    that the rich make themselves richer and not poorer,
    which is the true Gospel, for the poor's sake."
    -- Charles Williams. "Judgement at Chelmsford"
     
    John W. Kennedy, Mar 15, 2006
    #6
  7. Thomas 'PointedEars' Lahn, Mar 15, 2006
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.