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

2959Re: catch (exception) fails

Expand Messages
  • aceblchboy
    Aug 4, 2012
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Daniel" <dmorilha@...> wrote:
      >
      > In the case I repeat the same identifier on a catch block I receive an "'identifier' is already defined" error message.
      >
      > try {
      > } catch (exception) {
      > }
      >
      > ...
      >
      > try {
      > } catch (exception) {
      > }
      >
      > Is this a bug? If not why I can't use the same 'exception' or 'e' for all my catch blocks?
      >
      > As a good engineer I run out of creativity for identifiers and start appending numeric suffixes on all exception identifiers.
      >
      > thanks,
      >

      I believe the goal of this rule is to make it easier to identify exactly where the error is happening, and there's no shame in numbering. I also prefix with what the scope is as well. fooE1, barE1, barE2 etc. It makes it easier to pick out the error handler to watch.
    • Show all 2 messages in this topic