[Mod] Test使用with promise.catch():语法

This commit is contained in:
nanoric 2018-10-10 22:26:45 -04:00
parent 3f8e5f1099
commit b34dcf6a73

View File

@ -28,10 +28,11 @@ class TestRestClient(RestClient):
return req return req
def onError(self, exceptionType, exceptionValue, tb, req): def onError(self, exceptionType, exceptionValue, tb, req):
self.p.set_exception(exceptionValue) self.p.set_exception(exceptionType, exceptionValue, tb)
def onFailed(self, httpStatusCode, req): def onFailed(self, httpStatusCode, req):
self.p.set_exception(FailedError("request failed")) with self.p.catch():
raise FailedError("request failed")
class RestfulClientTest(unittest.TestCase): class RestfulClientTest(unittest.TestCase):