Browse Source

try catch dbo deserialize

tags/0.1.11
Robin Thoni 8 years ago
parent
commit
eed6883ff2
1 changed files with 13 additions and 14 deletions
  1. 13
    14
      src/Utils/LuRoute.php

+ 13
- 14
src/Utils/LuRoute.php View File

74
             }
74
             }
75
             catch (LuDboDeserializeException $e)
75
             catch (LuDboDeserializeException $e)
76
             {
76
             {
77
-                LuLog::log($e);
78
-                LuBusiness::badInput("Invalid value for '" . $param->getName() . "': " . $e->getMessage());
77
+                throw $e;
79
             }
78
             }
80
             catch (\Exception $e)
79
             catch (\Exception $e)
81
             {
80
             {
125
 
124
 
126
             $args = array();
125
             $args = array();
127
             foreach ($params as $param) {
126
             foreach ($params as $param) {
128
-                if ($param->isOptional()) {
129
-                    $value = null;
130
-                    if (LuBusiness::hasParam([$param->getName()])) {
131
-                        $value = $ctrl->getParam($param, LuBusiness::getParam($param->getName()));
127
+
128
+                try {
129
+                    if ($param->isOptional()) {
130
+                        $value = null;
131
+                        if (LuBusiness::hasParam([$param->getName()])) {
132
+                            $value = $ctrl->getParam($param, LuBusiness::getParam($param->getName()));
133
+                        }
134
+                        else {
135
+                            $value = $param->getDefaultValue();
136
+                        }
137
+                        $args[$param->getName()] = $value;
132
                     }
138
                     }
133
                     else {
139
                     else {
134
-                        $value = $param->getDefaultValue();
140
+                        $args[$param->getName()] = $ctrl->getParam($param, LuBusiness::checkParam($param->getName()));
135
                     }
141
                     }
136
-                    $args[$param->getName()] = $value;
137
-                }
138
-                else {
139
-                    $args[$param->getName()] = $ctrl->getParam($param, LuBusiness::checkParam($param->getName()));
140
-                }
141
-
142
-                try {
143
                     if (array_key_exists($param->getName(), $doc->getParams())) {
142
                     if (array_key_exists($param->getName(), $doc->getParams())) {
144
                         foreach ($doc->getParams()[$param->getName()]->getConstraints() as $constraint) {
143
                         foreach ($doc->getParams()[$param->getName()]->getConstraints() as $constraint) {
145
                             call_user_func_array([$args[$param->getName()], $constraint->getMethod()],
144
                             call_user_func_array([$args[$param->getName()], $constraint->getMethod()],

Loading…
Cancel
Save