You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewJsonRpcException(null, "The JSON sent is not a correct JSON-RPC request - incorrect id.", JSON_RPC_ERROR_REQUEST_INVALID);
73
+
}
74
+
68
75
if (!isset($request->jsonrpc) || $request->jsonrpc !== '2.0') {
69
-
thrownewJsonRpcException("The JSON sent is not a correct JSON-RPC request - missing or incorrect version.", JSON_RPC_ERROR_REQUEST_INVALID);
76
+
thrownewJsonRpcException($request->id, "The JSON sent is not a correct JSON-RPC request - missing or incorrect version.", JSON_RPC_ERROR_REQUEST_INVALID);
70
77
}
71
78
72
79
if (!isset($request->method) || !is_string($request->method) || (!$route = $this->parseMethod($request->method))) {
73
-
thrownewJsonRpcException("The JSON sent is not a correct JSON-RPC request - missing or incorrect method.", JSON_RPC_ERROR_REQUEST_INVALID);
80
+
thrownewJsonRpcException($request->id, "The JSON sent is not a correct JSON-RPC request - missing or incorrect method.", JSON_RPC_ERROR_REQUEST_INVALID);
74
81
}
75
82
76
83
$params = null;
77
84
if (isset($request->params)) {
78
85
$params = (array) $request->params;
79
86
}
80
87
81
-
if (!isset($request->id)) {
82
-
if (!is_int($request->id) && !ctype_digit($request->id)) {
83
-
thrownewJsonRpcException("The JSON sent is not a correct JSON-RPC request - incorrect id.", JSON_RPC_ERROR_REQUEST_INVALID);
84
-
}
85
-
}
86
-
87
88
return \Yii::createObject([
88
89
'class' => JsonRpcRequest::className(),
89
90
'id' => $request->id,
@@ -110,16 +111,14 @@ public function parseRequests($params) {
110
111
$result = $this->parseRequest($request);
111
112
}
112
113
catch (\Exception$exception) {
113
-
$result = ($exceptioninstanceof JsonRpcException)
114
-
? $exception
115
-
: newJsonRpcException("Error happened during request parsing.", JSON_RPC_ERROR_INTERNAL, $exception);
114
+
$result = $exception;
116
115
}
117
116
$results[] = $result;
118
117
}
119
118
return$results;
120
119
}
121
120
122
-
thrownewJsonRpcException("The JSON sent is not a correct JSON-RPC request.", JSON_RPC_ERROR_REQUEST_INVALID);
121
+
thrownewJsonRpcException(null, "The JSON sent is not a correct JSON-RPC request.", JSON_RPC_ERROR_REQUEST_INVALID);
123
122
}
124
123
125
124
/**
@@ -137,14 +136,14 @@ public function executeRequest($request) {
137
136
}
138
137
catch (\Exception$exception) {
139
138
if ($exceptioninstanceof InvalidRouteException) {
140
-
$result = newJsonRpcException('Method not found.', JSON_RPC_ERROR_METHOD_NOT_FOUND, $exception);
0 commit comments