douglascrockford/JSON-js — pull request #48 by frantzmiccoli (2012-12-06 10:30:27+00:00)
Title: Stringify fix : "Try catching" access to property to be more robust

````javascript
var BuggyClass = function() {
this.a = 12;

this.__defineGetter__("work", function(){
return "hello";
});

this.__defineGetter__("doesntWork", function(){
return value.anything;
});
};

var buggyObject = new BuggyClass(),
goodObject = {"a" : 12};

console.log(JSON.stringify(goodObject)); // works fine
console.log(JSON.stringify(buggyObject)); // crashes
````

This raised problems for debugger like node-codein https://github.com/ketamynx/node-codein/issues/3 when dependencies or user's code have getter only accessible following a given pattern. JSON.stringify could be more robust and just replace the error with an information.

If this is considered to be an error prone approach, maybe it would be a could thing to let user provide a function to handle error if he wishes it. Current situation is if a leaf of the object tree fails, the whole tree fails.