CA2201: throw correct exception type.

This commit is contained in:
Huo Yaoyuan
2019-11-28 21:52:05 +08:00
parent ecfc6dfa3d
commit d7b3578cc6
4 changed files with 15 additions and 4 deletions

View File

@ -122,7 +122,7 @@ namespace osu.Game.Online.API
// attempt to decode a displayable error string.
var error = JsonConvert.DeserializeObject<DisplayableError>(responseString);
if (error != null)
e = new Exception(error.ErrorMessage, e);
e = new APIException(error.ErrorMessage, e);
}
catch
{
@ -154,6 +154,14 @@ namespace osu.Game.Online.API
}
}
public class APIException : InvalidOperationException
{
public APIException(string messsage, Exception innerException)
: base(messsage, innerException)
{
}
}
public delegate void APIFailureHandler(Exception e);
public delegate void APISuccessHandler();