Don't allow throwing System.Exception (#8378)
This commit is contained in:
parent
d2e18547b1
commit
2d57e71b44
|
@ -995,7 +995,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("Tuner not found.");
|
throw new ResourceNotFoundException("Tuner not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken)
|
public async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken)
|
||||||
|
|
|
@ -13,6 +13,7 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using Jellyfin.Extensions.Json;
|
using Jellyfin.Extensions.Json;
|
||||||
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
@ -297,7 +298,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_taskCompletionSource.TrySetException(
|
_taskCompletionSource.TrySetException(
|
||||||
new Exception(
|
new FfmpegException(
|
||||||
string.Format(
|
string.Format(
|
||||||
CultureInfo.InvariantCulture,
|
CultureInfo.InvariantCulture,
|
||||||
"Recording for {0} failed. Exit code {1}",
|
"Recording for {0} failed. Exit code {1}",
|
||||||
|
|
|
@ -20,6 +20,7 @@ using Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using Jellyfin.Extensions.Json;
|
using Jellyfin.Extensions.Json;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
|
using MediaBrowser.Controller.Authentication;
|
||||||
using MediaBrowser.Controller.LiveTv;
|
using MediaBrowser.Controller.LiveTv;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
@ -591,13 +592,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
if (ex.StatusCode.HasValue)
|
if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.BadRequest)
|
||||||
{
|
{
|
||||||
if ((int)ex.StatusCode.Value == 400)
|
_tokens.Clear();
|
||||||
{
|
_lastErrorResponse = DateTime.UtcNow;
|
||||||
_tokens.Clear();
|
|
||||||
_lastErrorResponse = DateTime.UtcNow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
|
@ -662,7 +660,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
return root.Token;
|
return root.Token;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("Could not authenticate with Schedules Direct Error: " + root.Message);
|
throw new AuthenticationException("Could not authenticate with Schedules Direct Error: " + root.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddLineupToAccount(ListingsProviderInfo info, CancellationToken cancellationToken)
|
private async Task AddLineupToAccount(ListingsProviderInfo info, CancellationToken cancellationToken)
|
||||||
|
@ -697,7 +695,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(token))
|
if (string.IsNullOrEmpty(token))
|
||||||
{
|
{
|
||||||
throw new Exception("token required");
|
throw new ArgumentException("token required");
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Headends on account ");
|
_logger.LogInformation("Headends on account ");
|
||||||
|
@ -768,14 +766,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
var listingsId = info.ListingsId;
|
var listingsId = info.ListingsId;
|
||||||
if (string.IsNullOrEmpty(listingsId))
|
if (string.IsNullOrEmpty(listingsId))
|
||||||
{
|
{
|
||||||
throw new Exception("ListingsId required");
|
throw new ArgumentException("ListingsId required");
|
||||||
}
|
}
|
||||||
|
|
||||||
var token = await GetToken(info, cancellationToken).ConfigureAwait(false);
|
var token = await GetToken(info, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(token))
|
if (string.IsNullOrEmpty(token))
|
||||||
{
|
{
|
||||||
throw new Exception("token required");
|
throw new ArgumentException("token required");
|
||||||
}
|
}
|
||||||
|
|
||||||
using var options = new HttpRequestMessage(HttpMethod.Get, ApiUrl + "/lineups/" + listingsId);
|
using var options = new HttpRequestMessage(HttpMethod.Get, ApiUrl + "/lineups/" + listingsId);
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tcs.TrySetException(new Exception("SocketError: " + e.SocketError));
|
tcs.TrySetException(new SocketException((int)e.SocketError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tcs.TrySetException(new Exception("SocketError: " + e.SocketError));
|
tcs.TrySetException(new SocketException((int)e.SocketError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,8 @@
|
||||||
<!-- error on CA2016: Forward the CancellationToken parameter to methods that take one
|
<!-- error on CA2016: Forward the CancellationToken parameter to methods that take one
|
||||||
or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token -->
|
or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token -->
|
||||||
<Rule Id="CA2016" Action="Error" />
|
<Rule Id="CA2016" Action="Error" />
|
||||||
|
<!-- error on CA2201: Exception type System.Exception is not sufficiently specific -->
|
||||||
|
<Rule Id="CA2201" Action="Error" />
|
||||||
<!-- error on CA2215: Dispose methods should call base class dispose -->
|
<!-- error on CA2215: Dispose methods should call base class dispose -->
|
||||||
<Rule Id="CA2215" Action="Error" />
|
<Rule Id="CA2215" Action="Error" />
|
||||||
<!-- error on CA2254: Template should be a static expression -->
|
<!-- error on CA2254: Template should be a static expression -->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user