home-assistant-libs / pychromecast

Library for Python 3 to communicate with the Google Chromecast.
MIT License
2.51k stars 380 forks source link

Remove impossible exception handling in youtube controller #782

Closed emontnemery closed 6 months ago

emontnemery commented 6 months ago

The comment for the removed exception handling claims:

This gets the screenId but always throws

However, this is impossible, there's no case where we send a message and after that raise UnsupportedNamespace

MartinHjelmare commented 6 months ago

The base controller can raise. Will that path never be taken?

emontnemery commented 6 months ago

The base controller can raise. Will that path never be taken?

Sure, that path can be taken, but it's not expected and we should not catch and ignore it.

The code I want to remove have this comment:

# This gets the screenId but always throws. Couldn't find a better way.

This is impossible, as explained in the PR description and on Discord; there's no case where BaseController.send_message first sends a message and after that raises UnsupportedNamespace. Maybe there was some other bug in pychromecast when that code was added forcing the author to add the workaround.