Skip to content

Commit

Permalink
Test Runner failed in case of invalid Semver version issue fixes (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tan108 authored Aug 5, 2024
1 parent ab978ba commit d13cbeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/main/kotlin/com/featurevisor/sdk/Conditions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ object Conditions {
}

private fun compareVersions(actual: String, condition: String): Int {
return SemVer.parse(actual).compareTo(SemVer.parse(condition))
return try {
SemVer.parse(actual).compareTo(SemVer.parse(condition))
} catch (e: Exception) {
0
}
}
}
6 changes: 2 additions & 4 deletions src/main/kotlin/com/featurevisor/sdk/Instance+Evaluation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@ fun FeaturevisorInstance.evaluateVariation(featureKey: FeatureKey, context: Cont
evaluation = Evaluation(
featureKey = featureKey,
reason = ERROR,
error(e)
)

this.logger?.error("error", evaluation.toDictionary())
this.logger?.error(message = e.message.orEmpty(), details = evaluation.toDictionary())

return evaluation
}
Expand Down Expand Up @@ -433,10 +432,9 @@ fun FeaturevisorInstance.evaluateFlag(featureKey: FeatureKey, context: Context =
evaluation = Evaluation(
featureKey = featureKey,
reason = ERROR,
error(e)
)

this.logger?.error("error", evaluation.toDictionary())
this.logger?.error(message = e.message.orEmpty(), details = evaluation.toDictionary())

return evaluation
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fun startTest(option: TestProjectOption) {
try {
executionResult = executeTest(filePath, dataFile = datafile, option)
} catch (e: Exception) {
printMessageInRedColor("Exception in $filePath --> ${e.message}")
printMessageInRedColor("Exception while execution test --> ${e.message}")
}

if (executionResult == null) {
Expand Down

0 comments on commit d13cbeb

Please sign in to comment.