request/src/request.result/_exceptions/UnwrapException.cs

26 lines
681 B
C#
Raw Normal View History

// Copyright (c) The Geekeey Authors
// SPDX-License-Identifier: EUPL-1.2
namespace Geekeey.Request.Result;
/// <summary>
/// The exception is thrown when an <see cref="Result{T}"/> is attempted to be unwrapped contains only a failure value.
/// </summary>
public sealed class UnwrapException : Exception
{
/// <summary>
/// Creates a new <see cref="UnwrapException"/>.
/// </summary>
public UnwrapException()
: base("Cannot unwrap result because it does not have a value.")
{
}
/// <summary>
/// Creates a new <see cref="UnwrapException"/>.
/// </summary>
/// <param name="error">An error message.</param>
public UnwrapException(string error) : base(error)
{
}
}