so I feel really stupid, but why would `twist web -p "tls:cust-ws.service.consul:443:privateKey=/etc/ssl/private/*.service.consul.key" --wsgi cust_ws.wsgi.application` return `ValueError: Unknown endpoint type: 'tls'` ? is the new and shiny tls type legacy Python-only?
__marco joined the channel
faldridge joined the channel
faldridge has quit
cdunklau
hynek: perhaps you didn't install twisted[tls] ?
random thought, but hey, maybe
__marco has quit
nanonyme
meejah, yes, imo that would be reasonable assumption as well
Or should *every* frame that claims they return a Deferred always catch exceptions and roll them into deferred failures?
asdf
i don't think it's sane to take special care to make sure your function never throws an exception (and instead returns a failure) - because in python, mostly everything can possibly throw an exception, right
but in this case this looks like something i'd call validation i guess, so yeah, if it's part of the api, it should probably return a failure instead
nanonyme
asdf, that way of thinking means you can't rely on any Twisted API and must always use maybeDeferred
asdf
i mean in a "exceptions you know how to handle / expected by the programmer" vs "exceptions that you don't handle (which should bubble up)"
nanonyme
I mean, you can't really know what some other library will raise. You just have to turn *everything* into a Failure if you want your API to reliably return a Deferred
asdf
(i dont think the latter need to be failures)
nanonyme
Okay, so someone who actually can handle all failures then needs to wrap everything as maybeDeferred
As in, like, my errback handler was basically "okay, this URl failed, I'm going to log error and add it to ignore list"
Instead the synchronous exception went in some weird codepaths and apparently broke my reactor
kenaan
exarkun submitted <https://tm.tl/#9021> - twisted.python._url.URL docstring for .child() method is incorrect (unassigned) for review
cdunklau
hynek: from all i'm seeing it should be 'ssl', not 'tls'
efphe has quit
efphe joined the channel
nanonyme
asdf, and seriously my assumption was *everything* is Failures, then you trap in your errback
Apparently you just can't code like this in significant bulks of Twisted
I mean, having two parallel flow controls is just silly
Julian reviewed <https://tm.tl/#9021> - twisted.python._url.URL docstring for .child() method is incorrect (assigned to exarkun)
meejah
nanonyme: if a function is @inlineCallback-decorated then any exception will become a Failure. And ditto for maybeDeferred. but yeah I imagine stuff like SyntaxError will often be a synchronous exception for "normal" Deferred-returning functions
nanonyme
meejah, well, as in my traceback above, this was actually just some parse error in a string which was raised but layers of Twisted left it not wrapped as Failure since they were only doing it for expected exception types
Even when the API documented that these things always return Deferred's
I'm here trying to find some core devs to argue on this since it seems a philosophical thing to me and I don't want to start filing tickets until I've checked whether my idea is the same as with core devs'
I basically workarounded my specific case with maybeDeferred but it feels like a workaround to me
hynek
cdunklau: ssl: is deprecated in favor of TLS:…
hetii joined the channel
[0xAA] has quit
tomprince
Well, not deprecated in that it likely won't be removed any time soon.
meejah
nanonyme: yeah i'm not sure if there's a policy, but effectively all you're asking for is every public-API to be wrapped in maybeDeferred ;)
nanonyme
meejah, I guess. For every public API that isn't documented not to return a deferred anyway
But I think more that there would be a guarantee that API's that return a deferred never raise directly and whenever you hit a boundary between an API that does not return deferred, you wrap the return value and exception
So that you don't necessarily do it at public API level but API boundary level
If that makes any sense to you
meejah
sort-of. but i'm a little ambivilant on straight-up errors like SyntaxError etc
not that i'm a core twisted dev ;) so *shruggy-face* but ...
i've been using @inlineCallbacks "mostly" in a lot of my stuff, making that a sort of non-issue
tomprince
There are arguments either way.
__marco joined the channel
It is impossible to catch everything without doing `except:` everywhere which is problematic for other reasons.
Often, raising an exception is a bug.
nanonyme
tomprince, I'd be fine with even Exception being wrapped
tomprince
On the other hand, an argument could be made that raising an exception is reasonable, if a function was passed nonsense, rather than couldn't do what was asked.