mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-15 17:35:45 +00:00
fix(rest): change rest server result error type to string
This commit is contained in:
parent
e8dceb2aa6
commit
d5ef9331e7
@ -11,7 +11,7 @@ import
|
||||
presto
|
||||
|
||||
|
||||
type RestServerResult*[T] = Result[T, cstring]
|
||||
type RestServerResult*[T] = Result[T, string]
|
||||
|
||||
|
||||
### Configuration
|
||||
@ -84,10 +84,11 @@ proc init*(T: type RestServerRef,
|
||||
maxHeadersSize = maxHeadersSize,
|
||||
maxRequestBodySize = maxRequestBodySize
|
||||
)
|
||||
except CatchableError as ex:
|
||||
return err(cstring(ex.msg))
|
||||
except CatchableError:
|
||||
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,
|
||||
allowedOrigin=none(string),
|
||||
|
Loading…
x
Reference in New Issue
Block a user