question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeErrors against public interfaces.

See original GitHub issue

Partly prompted by this comment.

I think we should probably be a bit strict about enforcing types passed to our public interfaces. It’d be nice to raise loud clear errors, rather than failing with some arbitrary AttributeError in the middle of the codebase if a user passes something completely invalid to the interface. This would be stricter than what most Python libraries do, but I think it might be a good trade-off for us, to have a very strict and clearly demarked API.

That’d be easy enough to do since there’s not too many points we’d need to enforce. The big obvious one would be checking everything in AsyncClient.request(), which most of the rest of the public API calls into.

The would be some other bits & pieces to check too eg. Enforce that streaming data iterates through bytes/str, and not any other types. Enforce that dispatchers really do return a response type. Type checking on the various models that we expose.

Perhaps I’m being over-zelaous here? Any thoughts?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sethmlarsoncommented, Jul 15, 2019

I’d rather be strict about what we accept, then we don’t have to handle odd-ball cases down the road as a point of “backwards-compatibility” because it used to work but not on purpose.

0reactions
tomchristiecommented, Dec 11, 2019

We might want to have this at some point, but closing it as out-of-scope for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a better way to work with interfaces and get rid of ...
I'm stucked in a TypeError in my ReactJS project. The error: Server Error: TypeError: Cannot read properties of undefined (reading ...
Read more >
Understanding and using interfaces in TypeScript
TypeScript has inbuilt support for interfaces. ... Please note that the interface defines only the public properties of a class.
Read more >
Interfaces implementation visibility - Ethereum Stack Exchange
Remix report me a error: This contract does not implement all functions and thus cannot be created. Changing to public the Impl function:...
Read more >
zope.interface raises unhelpful "TypeError: Error when calling ...
zope.interface raises unhelpful "TypeError: Error when calling the metaclass bases" upon an invalid interface #5.
Read more >
Type Errors - Pyre
In typed Python, some classes that represent abstract interfaces may not be directly instantiated. Pyre considers a class C abstract, and will error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found