|
|  The idea is to not do the processing if the JSON parsing fails.
|

Then, why not just nest your try's? For readability reasons?

   var info, processed;
   try {
       info = JSON.parse(json);
       try {
           processed = process(info);
       } catch(ex) {
           ...
       }
   } catch (ex) {
       ...
   }

If it's the case, you could maybe use a Promise-like approach? With a bit of coding, you could probably even get something like

   val info, processed;
   trySequence(=> {
       info = JSON.parse(json);
   }).catch(ex => {
       ...
   }).then(=> {
       processed = process(info);
   }).catch(ex => {
       ...
   }).;


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to