Media Browser: Fix error handling (#7538)

This commit is contained in:
Zack Barett 2020-10-30 08:55:30 -05:00 committed by GitHub
parent 01fe5dd2f7
commit facb3266c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -540,17 +540,20 @@ export class HaMediaPlayerBrowse extends LitElement {
mediaContentType?: string
): Promise<MediaPlayerItem> {
this._loading = true;
const itemData =
this.entityId !== BROWSER_PLAYER
? await browseMediaPlayer(
this.hass,
this.entityId,
mediaContentId,
mediaContentType
)
: await browseLocalMediaPlayer(this.hass, mediaContentId);
this._loading = false;
let itemData: any;
try {
itemData =
this.entityId !== BROWSER_PLAYER
? await browseMediaPlayer(
this.hass,
this.entityId,
mediaContentId,
mediaContentType
)
: await browseLocalMediaPlayer(this.hass, mediaContentId);
} finally {
this._loading = false;
}
return itemData;
}