Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added handling for responseType 'LOAD_CANCELLED' #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cweitkamp
Copy link
Contributor

  • Added handling for responseType 'LOAD_CANCELLED'

Prevents warnings like these:

2020-05-07 17:00:02.993 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while handling, caused by com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'LOAD_CANCELLED' as a subtype of [simple type, class su.litvak.chromecast.api.v2.StandardResponse]: known type ids = [CLOSE, DEVICE_ADDED, DEVICE_REMOVED, DEVICE_UPDATED, GET_APP_AVAILABILITY, INVALID_REQUEST, LAUNCH_ERROR, LOAD_FAILED, MEDIA_STATUS, MULTIZONE_STATUS, PING, PONG, RECEIVER_STATUS]
 at [Source: (String)"{"requestId":5001,"responseType":"LOAD_CANCELLED","itemId":1}"; line: 1, column: 34]

Signed-off-by: Christoph Weitkamp [email protected]

Copy link
Owner

@vitalidze vitalidze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR. When do you receive such message?

Also, do you mind if I ask you to write unit-test(s) for this case?

@@ -380,7 +380,7 @@ private void connect() throws IOException, GeneralSecurityException {
if (response instanceof StandardResponse.Invalid) {
StandardResponse.Invalid invalid = (StandardResponse.Invalid) response;
throw new ChromeCastException("Invalid request: " + invalid.reason);
} else if (response instanceof StandardResponse.LoadFailed) {
} else if (response instanceof StandardResponse.LoadCancelled || response instanceof StandardResponse.LoadFailed) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should fall under the different if branch, throwing an error saying that the Load was cancelled. However I am not sure about the use case.

Signed-off-by: Christoph Weitkamp <[email protected]>
@cweitkamp
Copy link
Contributor Author

When do you receive such message?

This warning has been reported in our community: https://community.openhab.org/t/getting-error-playing-mp3-thru-google-assistant/98420

Also, do you mind if I ask you to write unit-test(s) for this case?

In general I would do it but I am afraid my time is very limited at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants