Skip to content
Snippets Groups Projects
Commit 38c66cef authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3075692 by Xiaohua Guan, yas: Fix an Internal Server Error when...

Issue #3075692 by Xiaohua Guan, yas: Fix an Internal Server Error when clicking the Refresh button in k8s Node and Namespace w/o connecting k8s master node (API endpoint)
parent 03a7c05f
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,11 @@ class K8sClient extends Client {
}
catch (BadRequestException $e) {
$error_info = json_decode($e->getMessage(), TRUE);
if (empty($error_info)) {
throw new K8sServiceException($this->t(
'Unknown error occurred when calling k8s API.'
));
}
$this->messenger->addError($this->t(
'Status Code: @status_code', ['@status_code' => $error_info['code']]
......
......@@ -472,7 +472,13 @@ class K8sService implements K8sServiceInterface {
return FALSE;
}
$result = $this->$get_entities_method($params);
$result = NULL;
try {
$result = $this->$get_entities_method($params);
}
catch (K8sServiceException $e) {
$this->messenger->addError($e->getMessage());
}
if ($result !== NULL) {
$all_entities = $this->loadAllEntities($entity_type);
$stale = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment