From 9c2b36e63622777042f7a46d08e1c769a2a55561 Mon Sep 17 00:00:00 2001 From: jangko Date: Sat, 27 Jan 2024 14:39:41 +0700 Subject: [PATCH] Use pragma push/pop pair to disable warning --- json_rpc/router.nim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/json_rpc/router.nim b/json_rpc/router.nim index 248f79d..a1c2cdd 100644 --- a/json_rpc/router.nim +++ b/json_rpc/router.nim @@ -151,7 +151,7 @@ proc route*(router: RpcRouter, data: string): ## converted to Json. ## Returns string of Json from RPC result/error node when defined(nimHasWarnBareExcept): - {.warning[BareExcept]:off.} + {.push warning[BareExcept]:off.} let request = try: @@ -172,7 +172,7 @@ proc route*(router: RpcRouter, data: string): return wrapError(JSON_ENCODE_ERROR, err.msg) when defined(nimHasWarnBareExcept): - {.warning[BareExcept]:on.} + {.pop warning[BareExcept]:on.} return reply @@ -181,8 +181,8 @@ proc tryRoute*(router: RpcRouter, data: JsonString, ## Route to RPC, returns false if the method or params cannot be found. ## Expects json input and returns json output. when defined(nimHasWarnBareExcept): - {.warning[BareExcept]:off.} - {.warning[UnreachableCode]:off.} + {.push warning[BareExcept]:off.} + {.push warning[UnreachableCode]:off.} try: let req = JrpcSys.decode(data.string, RequestRx) @@ -206,8 +206,8 @@ proc tryRoute*(router: RpcRouter, data: JsonString, return err(ex.msg) when defined(nimHasWarnBareExcept): - {.warning[BareExcept]:on.} - {.warning[UnreachableCode]:on.} + {.pop warning[BareExcept]:on.} + {.pop warning[UnreachableCode]:on.} macro rpc*(server: RpcRouter, path: static[string], body: untyped): untyped = ## Define a remote procedure call.