Skip to content

Commit

Permalink
[Gradle, JS] Refactor check on error
Browse files Browse the repository at this point in the history
#KT-38109 fixed
  • Loading branch information
ilgonmic committed Apr 16, 2020
1 parent 5969f1d commit 77d8864
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 77d8864

Please sign in to comment.