Skip to content

Can't catch errors of path params #28

Closed
@SerVB

Description

@SerVB

When I do http://localhost:8080/my/dassda , I want to see a bad request, but I get I received 0. Revision I use is be025c9. 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}")
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions