From 370a81d78a9963e3c2109cfe73b7a954fdf3b818 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 30 Jul 2019 13:30:26 +0900 Subject: [PATCH 1/4] Don't forward timeout exceptions to sentry --- osu.Game/Utils/RavenLogger.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index 7f4faa60ae..80786d2c72 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Net; using System.Threading.Tasks; using osu.Framework.Logging; using SharpRaven; @@ -46,6 +47,16 @@ namespace osu.Game.Utils return; } + if (exception is WebException we) + { + switch (we.Status) + { + // more statuses may need to be blocked as we come across them. + case WebExceptionStatus.Timeout: + return; + } + } + // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace)) From 6f91a21f00d9f4acce39109953c8f384b2d60da9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 30 Jul 2019 13:31:57 +0900 Subject: [PATCH 2/4] Use switch --- osu.Game/Utils/RavenLogger.cs | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index 80786d2c72..2a396d35cf 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -37,24 +37,27 @@ namespace osu.Game.Utils if (exception != null) { - if (exception is IOException ioe) + switch (exception) { - // disk full exceptions, see https://stackoverflow.com/a/9294382 - const int hr_error_handle_disk_full = unchecked((int)0x80070027); - const int hr_error_disk_full = unchecked((int)0x80070070); + case IOException ioe: + // disk full exceptions, see https://stackoverflow.com/a/9294382 + const int hr_error_handle_disk_full = unchecked((int)0x80070027); + const int hr_error_disk_full = unchecked((int)0x80070070); - if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full) - return; - } - - if (exception is WebException we) - { - switch (we.Status) - { - // more statuses may need to be blocked as we come across them. - case WebExceptionStatus.Timeout: + if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full) return; - } + + break; + + case WebException we: + switch (we.Status) + { + // more statuses may need to be blocked as we come across them. + case WebExceptionStatus.Timeout: + return; + } + + break; } // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. From 20b611486350e69582f7a5a126463f4ad1e78db7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 30 Jul 2019 17:52:06 +0900 Subject: [PATCH 3/4] Reduce method complexity --- osu.Game/Utils/RavenLogger.cs | 54 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index 2a396d35cf..6aaf55e045 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -37,35 +37,13 @@ namespace osu.Game.Utils if (exception != null) { - switch (exception) - { - case IOException ioe: - // disk full exceptions, see https://stackoverflow.com/a/9294382 - const int hr_error_handle_disk_full = unchecked((int)0x80070027); - const int hr_error_disk_full = unchecked((int)0x80070070); - - if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full) - return; - - break; - - case WebException we: - switch (we.Status) - { - // more statuses may need to be blocked as we come across them. - case WebExceptionStatus.Timeout: - return; - } - - break; - } + if (!shouldSubmitException(exception)) + return; // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace)) - { return; - } lastException = exception; queuePendingTask(raven.CaptureAsync(new SentryEvent(exception))); @@ -75,6 +53,34 @@ namespace osu.Game.Utils }; } + private bool shouldSubmitException(Exception exception) + { + switch (exception) + { + case IOException ioe: + // disk full exceptions, see https://stackoverflow.com/a/9294382 + const int hr_error_handle_disk_full = unchecked((int)0x80070027); + const int hr_error_disk_full = unchecked((int)0x80070070); + + if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full) + return false; + + break; + + case WebException we: + switch (we.Status) + { + // more statuses may need to be blocked as we come across them. + case WebExceptionStatus.Timeout: + return false; + } + + break; + } + + return true; + } + private void queuePendingTask(Task task) { lock (tasks) tasks.Add(task); From fab3ec3e5b670d881f0890690abdd678269e856e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 30 Jul 2019 19:28:02 +0900 Subject: [PATCH 4/4] Add maximum height to skin dropdown --- osu.Game/Overlays/Settings/Sections/SkinSection.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 5d7542ca2b..35be930a2e 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -107,6 +107,8 @@ namespace osu.Game.Overlays.Settings.Sections private class SkinDropdownControl : DropdownControl { protected override string GenerateItemText(SkinInfo item) => item.ToString(); + + protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200); } } }