mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-01-03 14:13:08 +00:00
Router.register should not raise exception
This commit is contained in:
parent
66208055bc
commit
f90e946b6a
@ -110,9 +110,12 @@ proc wrapError(code: int, msg: string): string =
|
||||
|
||||
proc init*(T: type RpcRouter): T = discard
|
||||
|
||||
proc register*(router: var RpcRouter, path: string, call: RpcProc)
|
||||
{.gcsafe, raises: [CatchableError].} =
|
||||
router.procs[path] = call
|
||||
proc register*(router: var RpcRouter, path: string, call: RpcProc) =
|
||||
# this proc should not raise exception
|
||||
try:
|
||||
router.procs[path] = call
|
||||
except CatchableError as exc:
|
||||
doAssert(false, exc.msg)
|
||||
|
||||
proc clear*(router: var RpcRouter) =
|
||||
router.procs.clear
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user