Fallback route

This commit is contained in:
2025-04-21 22:40:59 +02:00
parent 9279e1b776
commit 04d97eb4f8
4 changed files with 26 additions and 3 deletions

View File

@ -85,8 +85,14 @@ fun Routing.installDetails() {
get("/details/{id}") {
runCatching {
transaction {
val id = call.parameters["id"]?.let { UUID.fromString(it) }
?: throw HttpError("Missing or invalid ID")
val id = call.parameters["id"]?.let {
try {
UUID.fromString(it)
}
catch(e: IllegalArgumentException) {
throw HttpError("Invalid UUID: $it")
}
} ?: throw HttpError("Missing or invalid ID")
val intrinsic = Intrinsic.findById(id)
?: throw HttpError("Unknown intrinsic: $id")