mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 15:23:14 +08:00
Specify HitObjectConvertException.
This commit is contained in:
parent
b7976dce46
commit
80d5fa7243
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps.Objects.Catch
|
||||
{
|
||||
OsuBaseHit o = i as OsuBaseHit;
|
||||
|
||||
if (o == null) throw new Exception(@"Can't convert!");
|
||||
if (o == null) throw new HitObjectConvertException(@"Catch", i);
|
||||
|
||||
h = new Fruit
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Beatmaps.Objects
|
||||
@ -10,4 +11,13 @@ namespace osu.Game.Beatmaps.Objects
|
||||
{
|
||||
public abstract List<T> Convert(List<HitObject> input);
|
||||
}
|
||||
public class HitObjectConvertException : Exception
|
||||
{
|
||||
public HitObject Input { get; }
|
||||
public HitObjectConvertException(string modeName, HitObject input)
|
||||
: base($@"Can't convert from {input.GetType().Name} to {modeName} HitObject!")
|
||||
{
|
||||
Input = input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps.Objects.Mania
|
||||
{
|
||||
OsuBaseHit o = i as OsuBaseHit;
|
||||
|
||||
if (o == null) throw new Exception(@"Can't convert!");
|
||||
if (o == null) throw new HitObjectConvertException(@"Mania", i);
|
||||
|
||||
h = new Note
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Beatmaps.Objects.Taiko
|
||||
{
|
||||
OsuBaseHit o = i as OsuBaseHit;
|
||||
|
||||
if (o == null) throw new Exception(@"Can't convert!");
|
||||
if (o == null) throw new HitObjectConvertException(@"Taiko", i);
|
||||
|
||||
h = new TaikoBaseHit
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user