mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 00:13:06 +00:00
fix(rest): change rest server result error type to string
This commit is contained in:
parent
bf1ff25a47
commit
44b1f3bfe5
@ -11,7 +11,7 @@ import
|
|||||||
presto
|
presto
|
||||||
|
|
||||||
|
|
||||||
type RestServerResult*[T] = Result[T, cstring]
|
type RestServerResult*[T] = Result[T, string]
|
||||||
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
@ -84,10 +84,11 @@ proc init*(T: type RestServerRef,
|
|||||||
maxHeadersSize = maxHeadersSize,
|
maxHeadersSize = maxHeadersSize,
|
||||||
maxRequestBodySize = maxRequestBodySize
|
maxRequestBodySize = maxRequestBodySize
|
||||||
)
|
)
|
||||||
except CatchableError as ex:
|
except CatchableError:
|
||||||
return err(cstring(ex.msg))
|
return err(getCurrentExceptionMsg())
|
||||||
|
|
||||||
res
|
# RestResult error type is cstring, so we need to map it to string
|
||||||
|
res.mapErr(proc(err: cstring): string = $err)
|
||||||
|
|
||||||
proc newRestHttpServer*(ip: ValidIpAddress, port: Port,
|
proc newRestHttpServer*(ip: ValidIpAddress, port: Port,
|
||||||
allowedOrigin=none(string),
|
allowedOrigin=none(string),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user