diff --git a/json_rpc/clients/httpclient.nim b/json_rpc/clients/httpclient.nim index a37fa98..384db21 100644 --- a/json_rpc/clients/httpclient.nim +++ b/json_rpc/clients/httpclient.nim @@ -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) diff --git a/json_rpc/errors.nim b/json_rpc/errors.nim index 02acae6..e09940d 100644 --- a/json_rpc/errors.nim +++ b/json_rpc/errors.nim @@ -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