ajax.php
changeset 880 218b6d4de908
parent 870 82bbfe3dc8a0
child 963 b572ce1114f1
--- a/ajax.php	Sat Mar 21 19:11:30 2009 -0400
+++ b/ajax.php	Sun Mar 22 00:44:09 2009 -0400
@@ -187,9 +187,16 @@
       if ( !isset($_POST['r']) )
         die('Invalid request');
       
-      $request = enano_json_decode($_POST['r']);
-      if ( !isset($request['src']) || !isset($request['summary']) || !isset($request['minor_edit']) || !isset($request['time']) || !isset($request['draft']) )
-        die('Invalid request');
+      try
+      {
+        $request = enano_json_decode($_POST['r']);
+        if ( !isset($request['src']) || !isset($request['summary']) || !isset($request['minor_edit']) || !isset($request['time']) || !isset($request['draft']) )
+          die('Invalid request');
+      }
+      catch(Zend_Json_Exception $e)
+      {
+        die("JSON parsing failed. View as HTML to see full report.\n<br /><br />\n<pre>" . htmlspecialchars(strval($e)) . "</pre><br />Request: <pre>" . htmlspecialchars($_POST['r']) . "</pre>");
+      }
       
       $time = intval($request['time']);