<br><br>On Tuesday, December 6, 2011, Charlton Galvarino &lt;<a href="mailto:charlton@2creek.com">charlton@2creek.com</a>&gt; wrote:<br>&gt; 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>
&gt;<br>&gt; Original:<br>&gt;<br>&gt;    read: function(json, filter) {<br>&gt;        var object;<br>&gt;        if (this.nativeJSON) {<br>&gt;            object = JSON.parse(json, filter);<br>&gt;        } else try {<br>
&gt;            /**<br>&gt;             * Parsing happens in three stages. In the first stage, we run the<br>&gt;<br>&gt; Suggested change:<br>&gt;<br>&gt;    read: function(json, filter) {<br>&gt;        var object;<br>&gt;        if (this.nativeJSON) {<br>
&gt;            try {<br>&gt;               object = JSON.parse(json, filter);<br>&gt;            }<br>&gt;             catch(e) {<br>&gt;                 // Fall through if the parse fails.<br>&gt;             }<br>&gt;        } else try {<br>
&gt;            /**<br>&gt;             * 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>