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) HttpServer.create(initTAddress("127.0.0.1:8888"), flags = socketFlags)
when defined accepts: when defined accepts:
proc accepts() {.async, raises: [Defect].} = proc accepts() {.async, raises: [].} =
while true: while true:
try: try:
let req = await server.accept() let req = await server.accept()

View File

@ -14,7 +14,7 @@ import pkg/asynctest/unittest2
import ../../ws/ws import ../../ws/ws
type 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 HelperExtension = ref object of Ext
handler*: ExtHandler handler*: ExtHandler

View File

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

View File

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