<br><br>On Tuesday, December 6, 2011, Charlton Galvarino <<a href="mailto:charlton@2creek.com">charlton@2creek.com</a>> wrote:<br>> In OpenLayers/Format/JSON.js, it would be helpful to have another try/catch block. Sometimes my incoming JSON is bad, and as the code stands now, it throws a .js error and fails.<br>
><br>> Original:<br>><br>> read: function(json, filter) {<br>> var object;<br>> if (this.nativeJSON) {<br>> object = JSON.parse(json, filter);<br>> } else try {<br>
> /**<br>> * Parsing happens in three stages. In the first stage, we run the<br>><br>> Suggested change:<br>><br>> read: function(json, filter) {<br>> var object;<br>> if (this.nativeJSON) {<br>
> try {<br>> object = JSON.parse(json, filter);<br>> }<br>> catch(e) {<br>> // Fall through if the parse fails.<br>> }<br>> } else try {<br>
> /**<br>> * Parsing happens in three stages. In the first stage, we run the<br><br>Hi. OpenLayers devs much better prefer pull requests than diffs in mails. Thx :-)<br><br>-- <br>Eric Lemoine<br>
<br>Camptocamp France SAS<br>Savoie Technolac, BP 352<br>73377 Le Bourget du Lac, Cedex<br><br>Tel : 00 33 4 79 44 44 96<br>Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br><a href="http://www.camptocamp.com">http://www.camptocamp.com</a><br>
<br>