Hi,
Let say I have this code :
proc handler(req: Request) {.async.} =
if req.url.path == "/hello-world":
let msg = %* {"message": "Hello World"}
let headers = newHttpHeaders([("Content-Type","application/json")])
await req.respond(Http200, $msg, headers)
else:
await req.respond(Http404, "Not Found")
if there is an exception in respond for any reason, I can try except the await, is there any gain to discard req.respond(Http200, $msg, headers) because I do not care of the result, does it change something?you should check the asyncdispatch docs
for async logic its recommended to use yield / asyncCheck instead of discard / try, except
per your specific question, asyncCheck should be preferred