This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253735 - Local variable recognized as global in try-catch (JavaScript)
Summary: Local variable recognized as global in try-catch (JavaScript)
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-24 12:08 UTC by Eccenux
Modified: 2015-07-29 07:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eccenux 2015-07-24 12:08:58 UTC
Here is a mini example of try-catch that fails in Netbeans:

```
function test() {
	try {
		 throw "myException";
	} catch (error) {
		console.warn('parse error; ', error.name, ': ', error.message);
	}
}
```

Netbeans shows a warning for `error` variable assuming it is a global variable.

It only happens when I use `error.name` and not `error` alone. It's weird because the same example in a function works fine:

```
function errorLog(error) {
	console.warn('parse error; ', error.name, ': ', error.message);
}
```
Comment 1 Svata Dedic 2015-07-24 12:16:11 UTC
Javascript rather than java :)
Comment 2 Eccenux 2015-07-24 12:30:17 UTC
Yes, I forgot to mention that :-). Sorry.
Comment 3 Petr Pisl 2015-07-29 07:55:09 UTC
Fixed for NB 8.1