A Core/NosSmooth.Core/Errors/WalkNotFinishedError.cs => Core/NosSmooth.Core/Errors/WalkNotFinishedError.cs +18 -0
@@ 0,0 1,18 @@
+//
+// WalkNotFinishedError.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using Remora.Results;
+
+namespace NosSmooth.Core.Errors;
+
+/// <summary>
+/// Represents an error that can be returned from walk command handler.
+/// </summary>
+/// <param name="X">The x coordinate where the player is. (if known)</param>
+/// <param name="Y">The y coordinate where the player is. (if known)</param>
+/// <param name="Reason"></param>
+public record WalkNotFinishedError(int? X, int? Y, WalkUnfinishedReason Reason)
+ : ResultError($"Could not finish the walk to {X} {Y}, because {Reason}");<
\ No newline at end of file
A Core/NosSmooth.Core/Errors/WalkUnfinishedReason.cs => Core/NosSmooth.Core/Errors/WalkUnfinishedReason.cs +36 -0
@@ 0,0 1,36 @@
+//
+// WalkUnfinishedReason.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace NosSmooth.Core.Errors;
+
+/// <summary>
+/// Reason for not finishing a walk.
+/// </summary>
+public enum WalkUnfinishedReason
+{
+ /// <summary>
+ /// There was an unknown unfinished reason.
+ /// </summary>
+ Unknown,
+
+ /// <summary>
+ /// The client could not find path to the given location.
+ /// </summary>
+ /// <remarks>
+ /// The user walked just some part of the path.
+ /// </remarks>
+ PathNotFound,
+
+ /// <summary>
+ /// The user has took an action that has cancelled the walk.
+ /// </summary>
+ UserAction,
+
+ /// <summary>
+ /// There was another walk action that cancelled this one.
+ /// </summary>
+ AnotherTask
+}<
\ No newline at end of file