Reduce compiler warnings

This commit is contained in:
jangko 2024-01-25 17:44:23 +07:00
parent a7f9258b55
commit fc3c85581c
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
4 changed files with 7 additions and 5 deletions

View File

@ -58,7 +58,7 @@ when isMainModule:
HttpServer.create(initTAddress("127.0.0.1:8888"), flags = socketFlags)
when defined accepts:
proc accepts() {.async, raises: [Defect].} =
proc accepts() {.async, raises: [].} =
while true:
try:
let req = await server.accept()

View File

@ -14,7 +14,7 @@ import pkg/asynctest/unittest2
import ../../ws/ws
type
ExtHandler = proc(ext: Ext, frame: Frame): Future[Frame] {.raises: [Defect].}
ExtHandler = proc(ext: Ext, frame: Frame): Future[Frame] {.raises: [].}
HelperExtension = ref object of Ext
handler*: ExtHandler

View File

@ -7,7 +7,7 @@
## This file may not be copied, modified, or distributed except according to
## those terms.
{.push raises: [Defect].}
{.push raises: [].}
import std/[strutils, random]
import pkg/[
@ -64,12 +64,14 @@ proc createServer*(
flags = flags)
when defined accepts:
proc accepts() {.async, raises: [].} =
proc accepts() {.async: (raises: []).} =
try:
let req = await server.accept()
await req.handler()
except TransportOsError as exc:
error "Transport error", exc = exc.msg
except CatchableError as exc:
error "Unknown error", exc = exc.msg
asyncSpawn accepts()
else:

View File

@ -25,7 +25,7 @@ logScope:
type
HttpAsyncCallback* = proc (request: HttpRequest):
Future[void] {.closure, gcsafe, raises: [Defect].}
Future[void] {.closure, gcsafe, raises: [].}
HttpServer* = ref object of StreamServer
handler*: HttpAsyncCallback