Skip to content

Commit

Permalink
fix(rest): change rest server result error type to string
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorenzo Delgado committed Apr 19, 2023
1 parent e8dceb2 commit d5ef933
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions waku/v2/node/rest/server.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import
presto


type RestServerResult*[T] = Result[T, cstring]
type RestServerResult*[T] = Result[T, string]


### Configuration
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit d5ef933

Please sign in to comment.