Explorar el Código

try catch dbo deserialize

tags/0.1.11
Robin Thoni hace 8 años
padre
commit
eed6883ff2
Se han modificado 1 ficheros con 13 adiciones y 14 borrados
  1. 13
    14
      src/Utils/LuRoute.php

+ 13
- 14
src/Utils/LuRoute.php Ver fichero

@@ -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…
Cancelar
Guardar