File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 17
17
"rybakit/msgpack" : " ^0.7" ,
18
18
"rybakit/phpunit-extras" : " ^0.2" ,
19
19
"symfony/expression-language" : " ^3.3|^4|^5" ,
20
- "tarantool/client" : " ^0.7|^0. 8"
20
+ "tarantool/client" : " ^0.8"
21
21
},
22
22
"require-dev" : {
23
23
"php" : " ^7.1.3" ,
Original file line number Diff line number Diff line change @@ -32,4 +32,25 @@ public static function createEmptyResponse() : Response
32
32
{
33
33
return self ::createResponseFromData ([null ]);
34
34
}
35
+
36
+ public static function createErrorResponse (string $ errorMessage = '' , int $ errorCode = 0 ) : Response
37
+ {
38
+ return self ::createResponse (
39
+ [Keys::ERROR_24 => $ errorMessage ],
40
+ [Keys::CODE => Response::TYPE_ERROR + $ errorCode ]
41
+ );
42
+ }
43
+
44
+ public static function createErrorResponseFromStack (array $ errorStack ) : Response
45
+ {
46
+ $ errorMessage = $ errorStack [0 ][Keys::ERROR_MESSAGE ] ?? '' ;
47
+ $ errorCode = $ errorStack [0 ][Keys::ERROR_CODE ] ?? 0 ;
48
+
49
+ return self ::createResponse ([
50
+ Keys::ERROR_24 => $ errorMessage ,
51
+ Keys::ERROR => [Keys::ERROR_STACK => $ errorStack ],
52
+ ], [
53
+ Keys::CODE => Response::TYPE_ERROR + $ errorCode ,
54
+ ]);
55
+ }
35
56
}
You can’t perform that action at this time.
0 commit comments