File tree 1 file changed +13
-1
lines changed
src/main/kotlin/com/redhat/devtools/intellij/kubernetes/tree
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,19 @@ open class TreeStructure(
248
248
project
249
249
) {
250
250
override fun getLabel (element : java.lang.Exception ): String {
251
- return " Error: ${element.message ? : " unspecified" } "
251
+ return " Error: ${getMessage(element)} "
252
+ }
253
+
254
+ private fun getMessage (e : Exception ): String {
255
+ val causeMessage = e.cause?.message
256
+ /* *
257
+ * ex. KubernetesClientException:
258
+ * "Failure executing: GET at: https://api.sandbox-m3.1530.p1.openshiftapps.com:6443/apis/project.openshift.io/v1/projects.
259
+ * Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized."
260
+ */
261
+ return causeMessage?.substringAfter(" Message: " , causeMessage)
262
+ ? : e.message
263
+ ? : " unspecified"
252
264
}
253
265
254
266
override fun getIcon (element : java.lang.Exception ): Icon {
You can’t perform that action at this time.
0 commit comments