Skip to content

Commit b738293

Browse files
committed
fix(core): Return ErrorResponse when disabled plugins are used
This aligns the error response with other endpoints. Fixes #2668. Signed-off-by: Martin Nonnenmacher <[email protected]>
1 parent dac5c67 commit b738293

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

core/src/main/kotlin/api/ProductsRoute.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,11 @@ fun Route.products() = route("products/{productId}") {
414414
if (disabledPlugins.isNotEmpty()) {
415415
call.respond(
416416
HttpStatusCode.BadRequest,
417-
"The following plugins are disabled in this ORT Server instance: " +
418-
disabledPlugins.joinToString { (type, id) -> "$id ($type)" }
417+
ErrorResponse(
418+
message = "Disabled plugins are used.",
419+
cause = "The following plugins are disabled in this ORT Server instance: " +
420+
disabledPlugins.joinToString { (type, id) -> "$id ($type)" }
421+
)
419422
)
420423
return@post
421424
}

core/src/main/kotlin/api/RepositoriesRoute.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,11 @@ fun Route.repositories() = route("repositories/{repositoryId}") {
155155
if (disabledPlugins.isNotEmpty()) {
156156
call.respond(
157157
HttpStatusCode.BadRequest,
158-
"The following plugins are disabled in this ORT Server instance: " +
159-
disabledPlugins.joinToString { (type, id) -> "$id ($type)" }
158+
ErrorResponse(
159+
message = "Disabled plugins are used.",
160+
cause = "The following plugins are disabled in this ORT Server instance: " +
161+
disabledPlugins.joinToString { (type, id) -> "$id ($type)" }
162+
)
160163
)
161164
return@post
162165
}

0 commit comments

Comments
 (0)