[Gradle, JS] Refactor check on error

#KT-38109 fixed
This commit is contained in:
Ilya Goncharov
2020-04-15 11:21:55 +03:00
parent 5969f1dd4d
commit 77d8864abd
3 changed files with 8 additions and 6 deletions
@@ -48,8 +48,8 @@ class TeamCityMessageCommonClient(
if (inStackTrace) return
when (type) {
LogType.ERROR, LogType.WARN -> errors.add(value.clearAnsiColor())
if (type?.isErrorLike() == true) {
errors.add(value.clearAnsiColor())
}
type?.let { log.processLogMessage(value, it) }
@@ -66,6 +66,10 @@ enum class LogType(val value: String) {
DEBUG("debug"),
LOG("log");
fun isErrorLike(): Boolean {
return this == ERROR || this == WARN
}
companion object {
fun byValueOrNull(value: String?): LogType? {
if (value == null) return null
@@ -451,10 +451,8 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :
val actualText = if (launcherMessage != null) {
val (logLevel, message) = launcherMessage.destructured
actualType = LogType.byValueOrNull(logLevel.toLowerCase())
when (actualType) {
LogType.WARN, LogType.ERROR -> {
processFailedBrowsers(text)
}
if (actualType?.isErrorLike() == true) {
processFailedBrowsers(text)
}
message
} else {