Skip to content
Snippets Groups Projects
Unverified Commit 5100eba7 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Nicer error messages if a value is missing in an *_environments.json (#2283)

parent c6289aac
No related branches found
Tags v1.13.0-RC1
No related merge requests found
......@@ -86,17 +86,24 @@ class EnvironmentSetup @Inject constructor(
val targetEnvKey = if (environmentJson.has(currentEnvironment.rawKey)) {
currentEnvironment.rawKey
} else {
Timber.e("Tried to use unavailable environment: $variableKey on $currentEnvironment")
Timber.e("Tried to use unavailable environment: $currentEnvironment")
Type.PRODUCTION.rawKey
}
environmentJson
val value = environmentJson
.getAsJsonObject(targetEnvKey)
.getAsJsonPrimitive(variableKey.rawKey)
return@run if (value != null) {
Timber.v("getEnvironmentValue(endpoint=%s): %s", variableKey, value)
value
} else {
throw IllegalStateException("$currentEnvironment:$variableKey is missing in your *_environment.json")
}
} catch (e: Exception) {
Timber.e(e, "Failed to retrieve endpoint URL for $currentEnvironment:$variableKey")
throw IllegalStateException("Failed to setup test environment", e)
throw IllegalStateException("Failed to retrieve $currentEnvironment:$variableKey", e)
}
}.also { Timber.v("getEndpointUrl(endpoint=%s): %s", variableKey, it) }
}
val submissionCdnUrl: String
get() = getEnvironmentValue(SUBMISSION).asString
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment