Skip to content

Commit 2e412c5

Browse files
authored
Update Action.php
1 parent 68bcd95 commit 2e412c5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Action.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function parseMethod($method) {
4747
return false;
4848
}
4949

50-
$parts = explode($method, '.');
50+
$parts = explode('.', $method);
5151
foreach ($parts as $part) {
5252
// There cannot be empty part in route
5353
if (empty($part)) return false;
@@ -137,13 +137,15 @@ public function executeRequest($request) {
137137
$route = $request->route;
138138
try {
139139
\Yii::trace("Route requested: '$route'", __METHOD__);
140-
$this->requestedRoute = $route;
140+
\Yii::$app->requestedRoute = $route;
141141
$result = \Yii::$app->runAction($request->route, $request->params);
142142
return $result;
143143
}
144144
catch (\Exception $exception) {
145145
if ($exception instanceof InvalidRouteException) {
146-
return new Exception('Method not found.', JSON_RPC_ERROR_METHOD_NOT_FOUND);
146+
$result = new Exception('Method not found.', JSON_RPC_ERROR_METHOD_NOT_FOUND);
147+
$result->data['message'] = $exception->getMessage();
148+
return $result;
147149
}
148150
else if ($exception instanceof Exception) {
149151
return $exception;

0 commit comments

Comments
 (0)