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,8 +74,7 @@ class LuRoute {
74 74
             }
75 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 79
             catch (\Exception $e)
81 80
             {
@@ -125,21 +124,21 @@ class LuRoute {
125 124
 
126 125
             $args = array();
127 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 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 142
                     if (array_key_exists($param->getName(), $doc->getParams())) {
144 143
                         foreach ($doc->getParams()[$param->getName()]->getConstraints() as $constraint) {
145 144
                             call_user_func_array([$args[$param->getName()], $constraint->getMethod()],

Loading…
Cancel
Save