Преглед изворни кода

try catch dbo deserialize

tags/0.1.4^0
Robin Thoni пре 8 година
родитељ
комит
124e449f3a
1 измењених фајлова са 10 додато и 2 уклоњено
  1. 10
    2
      src/Utils/LuRoute.php

+ 10
- 2
src/Utils/LuRoute.php Прегледај датотеку

63
         }
63
         }
64
         else {
64
         else {
65
             $class = $param->getClass();
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
         return $typedValue;
77
         return $typedValue;
70
     }
78
     }

Loading…
Откажи
Сачувај