1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 15:23:14 +08:00

Specify HitObjectConvertException.

This commit is contained in:
Huo Yaoyuan 2016-10-13 20:53:42 +08:00
parent b7976dce46
commit 80d5fa7243
4 changed files with 13 additions and 3 deletions

View File

@ -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
{

View File

@ -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;
}
}
}

View File

@ -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
{

View File

@ -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
{