From 09b55a5b3252e30fa5610186cc605d55fe17b1ad Mon Sep 17 00:00:00 2001 From: coffeepots Date: Thu, 21 Jun 2018 18:40:49 +0100 Subject: [PATCH] More error checking (WIP) --- tests/testerrors.nim | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/testerrors.nim b/tests/testerrors.nim index 11501b8..cd6fcf8 100644 --- a/tests/testerrors.nim +++ b/tests/testerrors.nim @@ -45,24 +45,36 @@ suite "RPC Errors": # Note: We don't expect a exceptions for most of the tests, # because the server should respond with the error in json test "Missing RPC": - expect ValueError: + #expect ValueError: + try: let res = waitFor testMissingRpc() check res.error == true and res.result["message"] == %"Method not found" and res.result["data"] == %"phantomRpc is not a registered method." + except: + echo "Error ", getCurrentExceptionMsg() test "Incorrect json version": - expect ValueError: + #expect ValueError: + try: let res = waitFor testInvalidJsonVer() check res.error == true and res.result["message"] == %"JSON 2.0 required" + except: + echo "Error ", getCurrentExceptionMsg() test "Raising exceptions": - expect ValueError: + #expect ValueError: + try: let res = waitFor testRaise() + except: + echo "Error ", getCurrentExceptionMsg() test "Malformed json": # TODO: We time out here because the server won't be able to # find an id to return to us, so we cannot complete the future. - let res = waitFor testMalformed() - check res.error == true and res.result == %"Timeout" + try: + let res = waitFor testMalformed() + check res.error == true and res.result == %"Timeout" + except: + echo "Error ", getCurrentExceptionMsg()