1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 05:03:02 +08:00

Change exceptions which should be returned to the user to HubException type

See
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.signalr.hubexception?view=aspnetcore-5.0.
This commit is contained in:
Dean Herbert 2020-12-09 14:46:43 +09:00
parent 48129c52d6
commit c92c2cbfc0
4 changed files with 36 additions and 4 deletions

View File

@ -2,14 +2,22 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Runtime.Serialization;
using Microsoft.AspNetCore.SignalR;
namespace osu.Game.Online.RealtimeMultiplayer namespace osu.Game.Online.RealtimeMultiplayer
{ {
public class AlreadyInRoomException : Exception [Serializable]
public class AlreadyInRoomException : HubException
{ {
public AlreadyInRoomException() public AlreadyInRoomException()
: base("This user is already in a multiplayer room.") : base("This user is already in a multiplayer room.")
{ {
} }
protected AlreadyInRoomException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
} }
} }

View File

@ -2,14 +2,22 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Runtime.Serialization;
using Microsoft.AspNetCore.SignalR;
namespace osu.Game.Online.RealtimeMultiplayer namespace osu.Game.Online.RealtimeMultiplayer
{ {
public class InvalidStateChangeException : Exception [Serializable]
public class InvalidStateChangeException : HubException
{ {
public InvalidStateChangeException(MultiplayerUserState oldState, MultiplayerUserState newState) public InvalidStateChangeException(MultiplayerUserState oldState, MultiplayerUserState newState)
: base($"Cannot change from {oldState} to {newState}") : base($"Cannot change from {oldState} to {newState}")
{ {
} }
protected InvalidStateChangeException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
} }
} }

View File

@ -2,14 +2,22 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Runtime.Serialization;
using Microsoft.AspNetCore.SignalR;
namespace osu.Game.Online.RealtimeMultiplayer namespace osu.Game.Online.RealtimeMultiplayer
{ {
public class NotHostException : Exception [Serializable]
public class NotHostException : HubException
{ {
public NotHostException() public NotHostException()
: base("User is attempting to perform a host level operation while not the host") : base("User is attempting to perform a host level operation while not the host")
{ {
} }
protected NotHostException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
} }
} }

View File

@ -2,14 +2,22 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Runtime.Serialization;
using Microsoft.AspNetCore.SignalR;
namespace osu.Game.Online.RealtimeMultiplayer namespace osu.Game.Online.RealtimeMultiplayer
{ {
public class NotJoinedRoomException : Exception [Serializable]
public class NotJoinedRoomException : HubException
{ {
public NotJoinedRoomException() public NotJoinedRoomException()
: base("This user has not yet joined a multiplayer room.") : base("This user has not yet joined a multiplayer room.")
{ {
} }
protected NotJoinedRoomException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
} }
} }