Skip to content

Commit 82ab219

Browse files
AlexBeggsspabeggs
andauthored
Add error message for MavenRepository (#297)
- improve the error message to include a message in the stacktrace indicating what is the problem Co-authored-by: Alex Beggs <abeggs@spotify.com>
1 parent 8234ca6 commit 82ab219

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/kotlin/kscript/app/Script.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ fun Script.collectRepos(): List<MavenRepo> {
205205
.map { keyVal -> keyVal.split(keyValSep).map { it.trim(' ', '\"') }.let{ it.first() to it.last()}}
206206
.toMap()
207207

208+
if (annotationParams.size < 2) {
209+
throw IllegalArgumentException("Missing ${2 - annotationParams.size} of the required arguments for @file:MavenRepository(id, url)")
210+
}
208211
MavenRepo(
209212
namedArgs.getOrDefault("id", annotationParams[0]),
210213
namedArgs.getOrDefault("url", annotationParams[1]),

0 commit comments

Comments
 (0)