mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 23:58:47 +00:00
Inherit exceptions from VirtualParadiseException
This commit is contained in:
parent
c432437da7
commit
32bb9d92bb
@ -1,24 +1,39 @@
|
|||||||
namespace VpSharp.Exceptions;
|
using VpSharp.Internal;
|
||||||
|
|
||||||
|
namespace VpSharp.Exceptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception that is thrown when an operation was performed on an object that does not exist.
|
/// The exception that is thrown when an operation was performed on an object that does not exist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ObjectNotFoundException : Exception
|
public sealed class ObjectNotFoundException : VirtualParadiseException
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ObjectNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
public ObjectNotFoundException()
|
public ObjectNotFoundException()
|
||||||
|
: base(ReasonCode.ObjectNotFound)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ObjectNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
public ObjectNotFoundException(string message)
|
public ObjectNotFoundException(string message)
|
||||||
: base(message)
|
: base(ReasonCode.ObjectNotFound, message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ObjectNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
/// <param name="innerException">
|
||||||
|
/// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner
|
||||||
|
/// exception is specified.
|
||||||
|
/// </param>
|
||||||
public ObjectNotFoundException(string message, Exception innerException)
|
public ObjectNotFoundException(string message, Exception innerException)
|
||||||
: base(message, innerException)
|
: base(ReasonCode.ObjectNotFound, message, innerException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,39 @@
|
|||||||
namespace VpSharp.Exceptions;
|
using VpSharp.Internal;
|
||||||
|
|
||||||
|
namespace VpSharp.Exceptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception that is thrown when a user could not be found.
|
/// The exception that is thrown when a user could not be found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class UserNotFoundException : Exception
|
public sealed class UserNotFoundException : VirtualParadiseException
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="UserNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
public UserNotFoundException()
|
public UserNotFoundException()
|
||||||
|
: base(ReasonCode.NoSuchUser)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="UserNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
public UserNotFoundException(string message)
|
public UserNotFoundException(string message)
|
||||||
: base(message)
|
: base(ReasonCode.NoSuchUser, message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="UserNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
/// <param name="innerException">
|
||||||
|
/// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner
|
||||||
|
/// exception is specified.
|
||||||
|
/// </param>
|
||||||
public UserNotFoundException(string message, Exception innerException)
|
public UserNotFoundException(string message, Exception innerException)
|
||||||
: base(message, innerException)
|
: base(ReasonCode.NoSuchUser, message, innerException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,33 @@
|
|||||||
namespace VpSharp.Exceptions;
|
using VpSharp.Internal;
|
||||||
|
|
||||||
|
namespace VpSharp.Exceptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception that is thrown when the version of the .NET wrapper and the version of the native SDK do not match.
|
/// The exception that is thrown when the version of the .NET wrapper and the version of the native SDK do not match.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class VersionMismatchException : Exception
|
public sealed class VersionMismatchException : VirtualParadiseException
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VersionMismatchException" /> class.
|
||||||
|
/// </summary>
|
||||||
public VersionMismatchException()
|
public VersionMismatchException()
|
||||||
: this("The version of the .NET wrapper and the version of the native SDK do not match.")
|
: this("The version of the .NET wrapper and the version of the native SDK do not match.")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VersionMismatchException" /> class.
|
||||||
|
/// </summary>
|
||||||
public VersionMismatchException(string message)
|
public VersionMismatchException(string message)
|
||||||
: base(message)
|
: base(ReasonCode.VersionMismatch, message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VersionMismatchException" /> class.
|
||||||
|
/// </summary>
|
||||||
public VersionMismatchException(string message, Exception innerException)
|
public VersionMismatchException(string message, Exception innerException)
|
||||||
: base(message, innerException)
|
: base(ReasonCode.VersionMismatch, message, innerException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
78
VpSharp/src/Exceptions/VirtualParadiseException.cs
Normal file
78
VpSharp/src/Exceptions/VirtualParadiseException.cs
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
using VpSharp.Internal;
|
||||||
|
|
||||||
|
namespace VpSharp.Exceptions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The exception that is thrown when an operation fails in the native SDK.
|
||||||
|
/// </summary>
|
||||||
|
public class VirtualParadiseException : Exception
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VirtualParadiseException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
public VirtualParadiseException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VirtualParadiseException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
public VirtualParadiseException(string message)
|
||||||
|
: base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VirtualParadiseException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
/// <param name="innerException">
|
||||||
|
/// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner
|
||||||
|
/// exception is specified.
|
||||||
|
/// </param>
|
||||||
|
public VirtualParadiseException(string message, Exception innerException) : base(message, innerException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VirtualParadiseException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reasonCode">The underlying reason code.</param>
|
||||||
|
internal VirtualParadiseException(ReasonCode reasonCode)
|
||||||
|
{
|
||||||
|
ReasonCode = reasonCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VirtualParadiseException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reasonCode">The underlying reason code.</param>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
internal VirtualParadiseException(ReasonCode reasonCode, string message)
|
||||||
|
: base(message)
|
||||||
|
{
|
||||||
|
ReasonCode = reasonCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VirtualParadiseException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reasonCode">The underlying reason code.</param>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
/// <param name="innerException">
|
||||||
|
/// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner
|
||||||
|
/// exception is specified.
|
||||||
|
/// </param>
|
||||||
|
internal VirtualParadiseException(ReasonCode reasonCode, string message, Exception innerException)
|
||||||
|
: base(message, innerException)
|
||||||
|
{
|
||||||
|
ReasonCode = reasonCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the reason code.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The reason code.</value>
|
||||||
|
internal ReasonCode ReasonCode { get; }
|
||||||
|
}
|
@ -1,24 +1,71 @@
|
|||||||
namespace VpSharp.Exceptions;
|
using VpSharp.Internal;
|
||||||
|
|
||||||
|
namespace VpSharp.Exceptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception that is thrown when an attempt to access a world does not exist.
|
/// The exception that is thrown when an attempt to access a world does not exist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class WorldNotFoundException : Exception
|
public sealed class WorldNotFoundException : VirtualParadiseException
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
public WorldNotFoundException()
|
/// Initializes a new instance of the <see cref="WorldNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
public WorldNotFoundException() : base(ReasonCode.WorldNotFound)
|
||||||
{
|
{
|
||||||
|
WorldName = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="WorldNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="worldName">The name of the world that wasn't found.</param>
|
||||||
public WorldNotFoundException(string worldName)
|
public WorldNotFoundException(string worldName)
|
||||||
: base($"No world with the name {worldName} was found.")
|
: this(worldName, $"No world with the name {worldName} was found.")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="WorldNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="worldName">The name of the world that wasn't found.</param>
|
||||||
|
/// <param name="innerException">
|
||||||
|
/// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner
|
||||||
|
/// exception is specified.
|
||||||
|
/// </param>
|
||||||
public WorldNotFoundException(string worldName, Exception innerException)
|
public WorldNotFoundException(string worldName, Exception innerException)
|
||||||
: base($"No world with the name {worldName} was found.", innerException)
|
: this(worldName, $"No world with the name {worldName} was found.", innerException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="WorldNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="worldName">The name of the world that wasn't found.</param>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
public WorldNotFoundException(string worldName, string message)
|
||||||
|
: base(ReasonCode.WorldNotFound, message)
|
||||||
|
{
|
||||||
|
WorldName = worldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="WorldNotFoundException" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="worldName">The name of the world that wasn't found.</param>
|
||||||
|
/// <param name="message">The message that describes the error.</param>
|
||||||
|
/// <param name="innerException">
|
||||||
|
/// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner
|
||||||
|
/// exception is specified.
|
||||||
|
/// </param>
|
||||||
|
public WorldNotFoundException(string worldName, string message, Exception innerException)
|
||||||
|
: base(ReasonCode.WorldNotFound, message, innerException)
|
||||||
|
{
|
||||||
|
WorldName = worldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the world that wasn't found.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name of the world that wasn't found.</value>
|
||||||
|
public string WorldName { get; }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user