From fc3c85581ca5428f074b13ff7d6ae9c3019ef990 Mon Sep 17 00:00:00 2001 From: jangko Date: Thu, 25 Jan 2024 17:44:23 +0700 Subject: [PATCH] Reduce compiler warnings --- examples/server.nim | 2 +- tests/extensions/testextflow.nim | 2 +- tests/helpers.nim | 6 ++++-- websock/http/server.nim | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/server.nim b/examples/server.nim index 2215dbc7f2..e7bc467ee7 100644 --- a/examples/server.nim +++ b/examples/server.nim @@ -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() diff --git a/tests/extensions/testextflow.nim b/tests/extensions/testextflow.nim index 545e7599e9..c11b1f188e 100644 --- a/tests/extensions/testextflow.nim +++ b/tests/extensions/testextflow.nim @@ -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 diff --git a/tests/helpers.nim b/tests/helpers.nim index 77484bc723..8ca07ce943 100644 --- a/tests/helpers.nim +++ b/tests/helpers.nim @@ -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: diff --git a/websock/http/server.nim b/websock/http/server.nim index 78a20c9396..148dc0bfb9 100644 --- a/websock/http/server.nim +++ b/websock/http/server.nim @@ -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