diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-12-27 03:16:41 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-12-27 03:16:41 -0500 |
| commit | 6f2cb0b0d9353240441d4aa5dd2d46341ab9b4cb (patch) | |
| tree | 4b111f8b921109ddef9bd56c5b0297b510ac5cbd /Emby.Server.Implementations | |
| parent | b8e285035c9b68128eb283c81877fde2984ed4b6 (diff) | |
| parent | d7b0dcd91b4301c7bd68bce14964f3dd4082b310 (diff) | |
Merge pull request #2367 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations')
4 files changed, 30 insertions, 12 deletions
diff --git a/Emby.Server.Implementations/Connect/ConnectManager.cs b/Emby.Server.Implementations/Connect/ConnectManager.cs index b7faaa901..8c8b7b026 100644 --- a/Emby.Server.Implementations/Connect/ConnectManager.cs +++ b/Emby.Server.Implementations/Connect/ConnectManager.cs @@ -570,9 +570,9 @@ namespace Emby.Server.Implementations.Connect } catch (HttpException ex) { - if (!ex.StatusCode.HasValue) + if (!ex.StatusCode.HasValue || ex.IsTimedOut) { - throw; + throw new Exception("Unable to invite guest, " + ex.Message, ex); } // If they entered a username, then whatever the error is just throw it, for example, user not found diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index ae2165191..7ee0c566f 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -424,6 +424,9 @@ <ItemGroup> <EmbeddedResource Include="Localization\Ratings\us.txt" /> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Localization\Ratings\uk.txt" /> + </ItemGroup> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 83885ee2e..4e7dc8836 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -91,16 +91,12 @@ namespace Emby.Server.Implementations.HttpServer readonly Dictionary<Type, int> _mapExceptionToStatusCode = new Dictionary<Type, int> { - {typeof (InvalidOperationException), 500}, - {typeof (NotImplementedException), 500}, {typeof (ResourceNotFoundException), 404}, {typeof (FileNotFoundException), 404}, //{typeof (DirectoryNotFoundException), 404}, {typeof (SecurityException), 401}, {typeof (PaymentRequiredException), 402}, - {typeof (UnauthorizedAccessException), 500}, - {typeof (PlatformNotSupportedException), 500}, - {typeof (NotSupportedException), 500} + {typeof (ArgumentException), 400} }; public override void Configure() @@ -228,6 +224,22 @@ namespace Emby.Server.Implementations.HttpServer } } + private int GetStatusCode(Exception ex) + { + if (ex is ArgumentException) + { + return 400; + } + + int statusCode; + if (!_mapExceptionToStatusCode.TryGetValue(ex.GetType(), out statusCode)) + { + statusCode = 500; + } + + return statusCode; + } + private void ErrorHandler(Exception ex, IRequest httpReq, bool logException = true) { try @@ -244,11 +256,7 @@ namespace Emby.Server.Implementations.HttpServer return; } - int statusCode; - if (!_mapExceptionToStatusCode.TryGetValue(ex.GetType(), out statusCode)) - { - statusCode = 500; - } + var statusCode = GetStatusCode(ex); httpRes.StatusCode = statusCode; httpRes.ContentType = "text/html"; diff --git a/Emby.Server.Implementations/Localization/Ratings/uk.txt b/Emby.Server.Implementations/Localization/Ratings/uk.txt new file mode 100644 index 000000000..20440921f --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/uk.txt @@ -0,0 +1,7 @@ +UK-U,1 +UK-PG,5 +UK-12,7 +UK-12A,7 +UK-15,9 +UK-18,10 +UK-R18,15
\ No newline at end of file |
