Skip to content

Commit d1c6530

Browse files
authored
add class exist check
1 parent 7883c9e commit d1c6530

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Traits/RequestTrait.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ protected function handleGrpcStatus($service, $method, $status)
186186
'credentials' => $this->ydb->iam()->getCredentials()
187187
]);
188188
if (isset(self::$grpcExceptions[$status->code])) {
189+
if (!class_exists(self::$grpcExceptions[$status->code])){
190+
$this->logger->error("Class ".self::$grpcExceptions[$status->code]." not found");
191+
throw new \Exception($message);
192+
}
189193
throw new self::$grpcExceptions[$status->code]($message);
190194
} else {
191195
throw new \Exception($message);
@@ -255,7 +259,11 @@ protected function processResponse($service, $method, $response, $resultClass)
255259
);
256260

257261
$msg = 'YDB ' . $service . ' ' . $method . ' (YDB_' . $statusCode . ' ' . $statusName . '): ' . $message;
258-
if (isset(self::$ydbExceptions[$statusCode])) {
262+
if (isset(self::$ydbExceptions[$statusCode]) && class_exists(self::$ydbExceptions[$statusCode])) {
263+
if (!class_exists(self::$ydbExceptions[$status->code])){
264+
$this->logger->error("Class ".self::$ydbExceptions[$status->code]." not found");
265+
throw new \Exception($message);
266+
}
259267
throw new self::$ydbExceptions[$statusCode]($msg);
260268
} else {
261269
throw new \Exception($msg);

0 commit comments

Comments
 (0)