mirror of
https://github.com/status-im/nim-json-rpc.git
synced 2025-02-24 18:28:10 +00:00
The ErrorResponse exception now preserves information about the HTTP status code and reason
This commit is contained in:
parent
38950a786d
commit
07e4705b1f
@ -99,7 +99,7 @@ method call*(client: RpcHttpClient, name: string,
|
||||
|
||||
if res.status < 200 or res.status >= 300: # res.status is not 2xx (success)
|
||||
closeRefs()
|
||||
raise newException(ErrorResponse, "POST Response: " & $res.status)
|
||||
raise (ref ErrorResponse)(status: res.status, msg: res.reason)
|
||||
|
||||
debug "Message sent to RPC server",
|
||||
address = client.httpAddress, msg_len = len(reqBody)
|
||||
|
@ -3,6 +3,7 @@ type
|
||||
## Base type of all nim-json-rpc errors
|
||||
|
||||
ErrorResponse* = object of JsonRpcError
|
||||
status*: int
|
||||
## raised when the server responded with an error
|
||||
|
||||
InvalidResponse* = object of JsonRpcError
|
||||
|
Loading…
x
Reference in New Issue
Block a user