Skip to content

Commit fdbd9c2

Browse files
committed
♻️:: network gradle getApiKey 함수 null 체크
1 parent 72de909 commit fdbd9c2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/network/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import java.io.FileInputStream
2+
import java.io.FileNotFoundException
23
import java.util.Properties
34

45
@Suppress("DSL_SCOPE_VIOLATION")
@@ -42,7 +43,10 @@ dependencies {
4243

4344
fun getApiKey(propertyKey: String): String {
4445
val propFile = rootProject.file("./local.properties")
46+
if (!propFile.exists()) {
47+
throw FileNotFoundException("local.properties file not found")
48+
}
4549
val properties = Properties()
4650
properties.load(FileInputStream(propFile))
47-
return properties.getProperty(propertyKey)
51+
return properties.getProperty(propertyKey) ?: throw IllegalArgumentException("Property $propertyKey not found in local.properties file")
4852
}

0 commit comments

Comments
 (0)