mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 21:52:58 +08:00
Fix notifiation stack trace output on mania conversion failure
This commit is contained in:
parent
f806286dda
commit
b26c8e3b9e
@ -55,15 +55,18 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
|||||||
{
|
{
|
||||||
int iterations = 0;
|
int iterations = 0;
|
||||||
|
|
||||||
while (condition() && iterations++ < max_rng_iterations)
|
while (condition())
|
||||||
action();
|
{
|
||||||
|
if (iterations++ >= max_rng_iterations)
|
||||||
if (iterations < max_rng_iterations)
|
{
|
||||||
|
// log an error but don't throw. we want to continue execution.
|
||||||
|
Logger.Error(new ExceededAllowedIterationsException(new StackTrace(0)),
|
||||||
|
"Conversion encountered errors. The beatmap may not be correctly converted.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Generate + log an error/stacktrace
|
action();
|
||||||
|
}
|
||||||
Logger.Log($"Allowable iterations ({max_rng_iterations}) exceeded:\n{new StackTrace(0)}", level: LogLevel.Error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -71,5 +74,20 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The <see cref="Pattern"/>s containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/>s containing the hit objects.</returns>
|
||||||
public abstract IEnumerable<Pattern> Generate();
|
public abstract IEnumerable<Pattern> Generate();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Denotes when a single conversion operation is in an infinitely looping state.
|
||||||
|
/// </summary>
|
||||||
|
public class ExceededAllowedIterationsException : Exception
|
||||||
|
{
|
||||||
|
private readonly string stackTrace;
|
||||||
|
|
||||||
|
public ExceededAllowedIterationsException(StackTrace stackTrace)
|
||||||
|
{
|
||||||
|
this.stackTrace = stackTrace.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string StackTrace => stackTrace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user