Loading ...
Sorry, an error occurred while loading the content.

catch(e) {}

Expand Messages
  • samckayak
    I m sure this has been asked before, but I searched this forum and scanned the jslint docs without finding an explanation. What is the rationalle in flagging
    Message 1 of 3 , Oct 1, 2009
    • 0 Attachment
      I'm sure this has been asked before, but I searched this forum and scanned the jslint docs without finding an explanation.

      What is the rationalle in flagging repeated use of the variable (e) in

      try {} catch(e) {}

      ...when a function contains more than one try/catch? Is there a best practice other than using distint event variable name in each try/catch?
    • Douglas Crockford
      ... Give each catch a distinct variable name.
      Message 2 of 3 , Oct 1, 2009
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "samckayak" <samc@...> wrote:
        >
        > I'm sure this has been asked before, but I searched this forum and scanned the jslint docs without finding an explanation.
        >
        > What is the rationalle in flagging repeated use of the variable (e) in
        >
        > try {} catch(e) {}
        >
        > ...when a function contains more than one try/catch? Is there a best > practice other than using distint event variable name in each
        > try/catch?

        Give each catch a distinct variable name.
      • pauanyu
        ... If I recall... the reason for this is that certain browsers mangle things when using the same name, correct?
        Message 3 of 3 , Oct 2, 2009
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
          >
          > Give each catch a distinct variable name.
          >

          If I recall... the reason for this is that certain browsers mangle things when using the same name, correct?
        Your message has been successfully submitted and would be delivered to recipients shortly.