Skip to content

show error details when fetching children fails (#20) #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,19 @@ open class TreeStructure(
project
) {
override fun getLabel(element: java.lang.Exception): String {
return "Error: ${element.message ?: "unspecified"}"
return "Error: ${getMessage(element)}"
}

private fun getMessage(e: Exception): String {
val causeMessage = e.cause?.message
/**
* ex. KubernetesClientException:
* "Failure executing: GET at: https://api.sandbox-m3.1530.p1.openshiftapps.com:6443/apis/project.openshift.io/v1/projects.
* Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized."
*/
return causeMessage?.substringAfter("Message: ", causeMessage)
?: e.message
?: "unspecified"
}

override fun getIcon(element: java.lang.Exception): Icon {
Expand Down