Every Error object gets a new PropertyMap after a recent change to capture stack trace @ constructor call.
var e1 = new Error()
var e2 = new Error()
print(Debug.map(e1) == Debug.map(e2))
prints false. Previously, the above evaluated to true. "nashornException" property is added to the instances at constructor. Note that previously error objects got exception property only when thrown -- at which these objects still got different PropertyMaps.
try {
throw e1
} catch (e) {
print(Debug.toIdentString(Debug.map(e)));
}
try {
throw e2
} catch (e) {
print(Debug.toIdentString(Debug.map(e)));
}
I think it is better to add nashornException as a @Property to NativeXYZError classes.