update components

pull/702/head
Luke Pulverenti 9 years ago
parent 8ea02ee020
commit 75a457debc

@ -8,8 +8,10 @@ using MediaBrowser.Model.Serialization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Net;
namespace MediaBrowser.Common.Implementations.Security namespace MediaBrowser.Common.Implementations.Security
{ {
@ -227,6 +229,16 @@ namespace MediaBrowser.Common.Implementations.Security
SaveAppStoreInfo(parameters); SaveAppStoreInfo(parameters);
throw; throw;
} }
catch (HttpException e)
{
_logger.ErrorException("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");
if (e.StatusCode.HasValue && e.StatusCode.Value == HttpStatusCode.PaymentRequired)
{
throw new PaymentRequiredException();
}
throw new ApplicationException("Error registering store sale");
}
catch (Exception e) catch (Exception e)
{ {
_logger.ErrorException("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT"); _logger.ErrorException("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");

@ -89,6 +89,7 @@
<Compile Include="ScheduledTasks\WeeklyTrigger.cs" /> <Compile Include="ScheduledTasks\WeeklyTrigger.cs" />
<Compile Include="Security\IRequiresRegistration.cs" /> <Compile Include="Security\IRequiresRegistration.cs" />
<Compile Include="Security\ISecurityManager.cs" /> <Compile Include="Security\ISecurityManager.cs" />
<Compile Include="Security\PaymentRequiredException.cs" />
<Compile Include="Updates\IInstallationManager.cs" /> <Compile Include="Updates\IInstallationManager.cs" />
<Compile Include="Updates\InstallationEventArgs.cs" /> <Compile Include="Updates\InstallationEventArgs.cs" />
<Compile Include="Updates\InstallationFailedEventArgs.cs" /> <Compile Include="Updates\InstallationFailedEventArgs.cs" />

@ -0,0 +1,8 @@
using System;
namespace MediaBrowser.Common.Security
{
public class PaymentRequiredException : Exception
{
}
}

@ -19,6 +19,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Security;
namespace MediaBrowser.Server.Implementations.HttpServer namespace MediaBrowser.Server.Implementations.HttpServer
{ {
@ -65,7 +66,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
} }
public HttpListenerHost(IApplicationHost applicationHost, public HttpListenerHost(IApplicationHost applicationHost,
ILogManager logManager, ILogManager logManager,
IServerConfigurationManager config, IServerConfigurationManager config,
string serviceName, string serviceName,
string defaultRedirectPath, params Assembly[] assembliesWithServices) string defaultRedirectPath, params Assembly[] assembliesWithServices)
@ -80,7 +81,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
} }
public string GlobalResponse { get; set; } public string GlobalResponse { get; set; }
public override void Configure(Container container) public override void Configure(Container container)
{ {
HostConfig.Instance.DefaultRedirectPath = DefaultRedirectPath; HostConfig.Instance.DefaultRedirectPath = DefaultRedirectPath;
@ -92,7 +93,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{typeof (FileNotFoundException), 404}, {typeof (FileNotFoundException), 404},
{typeof (DirectoryNotFoundException), 404}, {typeof (DirectoryNotFoundException), 404},
{typeof (SecurityException), 401}, {typeof (SecurityException), 401},
{typeof (UnauthorizedAccessException), 500} {typeof (PaymentRequiredException), 402},
{typeof (UnauthorizedAccessException), 500},
{typeof (ApplicationException), 500}
}; };
HostConfig.Instance.DebugMode = true; HostConfig.Instance.DebugMode = true;

Loading…
Cancel
Save