fun getExceptionMessage()

in azure-storage-common/src/main/kotlin/jetbrains/buildServer/serverSide/artifacts/azure/AzureUtils.kt [92:111]


    fun getExceptionMessage(exception: Throwable): String {
        val e = if (exception is NoSuchElementException)
            exception.cause ?: exception else exception
        return when (e) {
            is StorageException -> {
                if (e.cause is UnknownHostException) {
                    "Invalid account name: ${e.cause?.message}"
                } else {
                    "Invalid account key"
                }
            }
            is StringIndexOutOfBoundsException,
            is IllegalArgumentException -> {
                "Invalid account key"
            }
            else -> {
                e.message ?: e.toString()
            }
        }
    }