File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed
src/main/kotlin/com/redhat/devtools/gateway Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2025 Red Hat, Inc.
3
+ * This program and the accompanying materials are made
4
+ * available under the terms of the Eclipse Public License 2.0
5
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
6
+ *
7
+ * SPDX-License-Identifier: EPL-2.0
8
+ *
9
+ * Contributors:
10
+ * Red Hat, Inc. - initial API and implementation
11
+ */
12
+ package com.redhat.devtools.gateway.util
13
+
14
+ fun Throwable.rootMessage (): String {
15
+ var cause: Throwable ? = this
16
+ while (cause?.cause != null ) {
17
+ cause = cause.cause
18
+ }
19
+ return cause?.message?.trim()
20
+ ? : this .message?.substringAfter(" :" )?.trim()
21
+ ? : " Unknown error"
22
+ }
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import com.redhat.devtools.gateway.openshift.OpenShiftClientFactory
28
28
import com.redhat.devtools.gateway.openshift.Projects
29
29
import com.redhat.devtools.gateway.openshift.kube.KubeConfigBuilder
30
30
import com.redhat.devtools.gateway.settings.DevSpacesSettings
31
+ import com.redhat.devtools.gateway.util.rootMessage
31
32
import com.redhat.devtools.gateway.view.InformationDialog
32
33
import com.redhat.devtools.gateway.view.ui.FilteringComboBox
33
34
import com.redhat.devtools.gateway.view.ui.PasteClipboardMenu
@@ -118,17 +119,6 @@ class DevSpacesOpenShiftConnectionStepView(private var devSpacesContext: DevSpac
118
119
return success
119
120
}
120
121
121
- private fun Throwable.rootMessage (): String {
122
- // Walk down to the root cause
123
- var cause: Throwable ? = this
124
- while (cause?.cause != null ) {
125
- cause = cause.cause
126
- }
127
- return cause?.message?.trim()
128
- ? : this .message?.substringAfter(" :" )?.trim()
129
- ? : " Unknown error"
130
- }
131
-
132
122
private fun loadOpenShiftConnectionSettings () {
133
123
tfServer.removeAllItems()
134
124
allServers.forEach { tfServer.addItem(it) }
You can’t perform that action at this time.
0 commit comments