mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-05-07 10:49:28 +00:00
better possible exception handling in processReq
This commit is contained in:
parent
f9f2025b98
commit
7c03bfd9ac
@ -151,7 +151,14 @@ proc processRequest[T](
|
||||
nilProcess(request[].reqId)
|
||||
else:
|
||||
ctx[].registeredRequests[][reqId](request[].reqContent, ctx)
|
||||
handleRes(await retFut, request)
|
||||
|
||||
let res =
|
||||
try:
|
||||
await retFut
|
||||
except CatchableError as exc:
|
||||
Result[string, string].err("Exception in processRequest for " & reqId & ": " & exc.msg)
|
||||
|
||||
handleRes(res, request)
|
||||
|
||||
proc ffiThreadBody[T](ctx: ptr FFIContext[T]) {.thread.} =
|
||||
## FFI thread body that attends library user API requests
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user