Просмотр исходного кода

try catch dbo deserialize

tags/0.1.4^0
Robin Thoni 10 лет назад
Родитель
Сommit
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
     }

Загрузка…
Отмена
Сохранить