Thomas Grainger
Thomas Grainger
Yes On Wed, 8 May 2019, 23:01 Glyph, wrote: > By "correctly" I think you mean "in response to a Deferred being returned > by the callable"? > > —...
why return a failure rather than raise an exception?
@Julian but constructing the failure is synchronous, it's misleading to return a deferred unless you expect to perform asynchronous work ``` async def amain(): response = await treq.get(url) response.raise_for_status() defer.ensureDeferred(amain())...
> Failure is the asynchronous version of an exception -- the error has to be delivered to whoever made the request, not in the middle of the reactor spinning itself....
But why would fail/raise_for_status consume the body? Avoiding resource leaks is a separate concern: ```python async def amain(): async with treq.get(url) as response: response.raise_for_status() body = await response.content() task.react(lambda _:...
You can still avoid resource leaks in py2, using a continuation like _ConcurrencyMixin: ```python @defer.inlineCallbacks def txmain(): @defer.inlineCallbacks def continuation(response) response.raise_for_status() body = yield response.content() yield treq.get(url)(continuation) task.react(lambda _: txmain(),...
> I don't follow your example. How does it consume the body when `raise_for_status()` raises an exception? the continuation here is like the body of a context manager, when the...
they might not even need to be a lerna repo. Could just be a subpackage: eslint-plugin-lodash/fp
It would be a separate plugin and set of rules. It's just that it would be in the same repo, so shared bugs and features could be fixed/implimented at the...
@ganimomer could you reconsider this?