1

On Eclipse validator the keywords "finally" and "catch" seems not allowed:

$http.get(url)
.success(function (data) {
    // Handle data
})
.error(function (data, status) {
    // Handle HTTP error
})
.finally(function () {
    // Execute logic independent of success/error
});

On line 8 (.finally...) the validator says "Syntax error on token "finally", Identifier expected". If I remove the finally block, the error disappears.

Is there a way to say eclipse that this is not an error without disabling the complete validation?

regards Bytecounter

bytecounter
  • 133
  • 2
  • 11

1 Answers1

1

Disclaimer, I'm the author of tern.java.

Your problem comes from JSDT Validator which doesn't support ES5 syntax. I suggest you that you install tern.java which provides the capability to validate your JS file with JSHint https://github.com/angelozerr/tern.java/wiki/Tern-Linter-JSHint which is able to validate ES5/ES6 syntax.

Before using this validator, you must disable JSDT Validator (see EcmaScript 6 - Tern IDE for Eclipse validation errors)

Community
  • 1
  • 1
Angelo
  • 2,027
  • 13
  • 17