Browse Source

try catch dbo deserialize

tags/0.1.4^0
Robin Thoni 8 years ago
parent
commit
124e449f3a
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      src/Utils/LuRoute.php

+ 10
- 2
src/Utils/LuRoute.php View File

@@ -63,8 +63,16 @@ class LuRoute {
63 63
         }
64 64
         else {
65 65
             $class = $param->getClass();
66
-            $json = json_decode($value, true);
67
-            $typedValue = call_user_func_array(array($class->getName(), "jsonDeserialize"), array($json));
66
+            try
67
+            {
68
+                $json = json_decode($value, true);
69
+                $typedValue = call_user_func_array(array($class->getName(), "jsonDeserialize"), array($json));
70
+            }
71
+            catch (\Exception $e)
72
+            {
73
+                LuLog::log($e);
74
+                LuBusiness::badInput("Unable to parse JSON value for " . $param->getName());
75
+            }
68 76
         }
69 77
         return $typedValue;
70 78
     }

Loading…
Cancel
Save