Skip to content

Commit

Permalink
Exception handling for endpointFocus causes a different type of Excep…
Browse files Browse the repository at this point in the history
…tion to be thrown for the focus. In my opinion, it is better to throw Java.lang.IllegalArgumentException for all those 3 cases:

1. endpointFocus does not exist
2. endpointPrefix does not exist
3. Both endpointFocus and endpointPrefix are provided.
  • Loading branch information
onurd86 committed Sep 27, 2023
1 parent e2dffba commit 553bcbb
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ object EndpointFilter {
val all = swagger.paths.map{it.key}

val selection = if(config.endpointFocus != null) {
if (all.none { it == config.endpointFocus }) {
throw IllegalArgumentException(
"Invalid endpointFocus: ${config.endpointFocus}. " +
"\nAvailable:\n${all.joinToString("\n")}"
)
}
all.filter { it != config.endpointFocus }
} else if(config.endpointPrefix != null){
all.filter { ! it.startsWith(config.endpointPrefix!!) }
Expand Down

0 comments on commit 553bcbb

Please sign in to comment.