Can't catch errors of path params
See original GitHub issueWhen I do http://localhost:8080/my/dassda , I want to see a bad request, but I get I received 0
. Revision I use is be025c92. Is there a way to handle bad params?
@Path("{iii}")
data class MyParam(@PathParam("I'm int") val iii: Int)
route("my") {
throws(
status = HttpStatusCode.BadRequest,
example = "bad request",
exClass = Throwable::class
) {
get<MyParam, String> { param ->
respond("I received ${param.iii}")
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Can't catch the URL parameters with ExpressJS - Stack Overflow
if you want the catch the value in the url means use req.query instead of req.params pass the value using the key of...
Read more >Path Parameters - FastAPI
You can declare path "parameters" or "variables" with the same syntax used by Python format strings: from fastapi import FastAPI app = FastAPI() ......
Read more >Error handling - Express.js
It's important to ensure that Express catches all errors that occur while running route handlers and middleware. Errors that occur in synchronous code ......
Read more >Exceptions - Manual - PHP
(The variable was required prior to PHP 8.0.0.) The first catch block a thrown exception or error encounters that matches the type of...
Read more >Error Handling | tsoa - GitHub Pages
Handling missing routes #. In order to handle missing urls more gracefully, we can add a "catch-all" route handler: ts
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could also create a processor like this to remove the nullable and throw your custom error: https://github.com/papsign/Ktor-OpenAPI-Generator/blob/reworked-model/src/main/kotlin/com/papsign/ktor/openapigen/annotations/type/number/integer/min/MinProcessor.kt
You can replace the primitive default values with a ParsingError throw in https://github.com/papsign/Ktor-OpenAPI-Generator/blob/reworked-model/src/main/kotlin/com/papsign/ktor/openapigen/parameters/parsers/converters/primitive/PrimitiveConverter.kt I can’t work on it today as i am on a consulting mission.