[Mod] Test使用with promise.catch():语法
This commit is contained in:
parent
3f8e5f1099
commit
b34dcf6a73
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user