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 1717 "rybakit/msgpack" : " ^0.7" ,
1818 "rybakit/phpunit-extras" : " ^0.2" ,
1919 "symfony/expression-language" : " ^3.3|^4|^5" ,
20- "tarantool/client" : " ^0.7|^0. 8"
20+ "tarantool/client" : " ^0.8"
2121 },
2222 "require-dev" : {
2323 "php" : " ^7.1.3" ,
Original file line number Diff line number Diff line change @@ -32,4 +32,25 @@ public static function createEmptyResponse() : Response
3232 {
3333 return self ::createResponseFromData ([null ]);
3434 }
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+ }
3556}
You can’t perform that action at this time.
0 commit comments