using Apewer.Web;
using System;
namespace Apewer
{
/// 表示目标资源不存在的错误。
public class NotFoundException : Exception, IApiException
{
static string _default = FixMessage(null);
static string FixMessage(string message)
{
const string Preset = "Resource not found.";
if (message != null)
{
message = message.Trim();
if (!string.IsNullOrEmpty(message)) return message;
}
return Preset;
}
/// 获取或设置默认消息。
public static string DefaultMessage { get => _default; set => _default = FixMessage(value); }
/// 状态。
/// Unauthorized
public virtual string Status { get => "Not Found"; }
/// 表示目标资源不存在的错误。
/// 默认消息:Operation is not authorized.
public NotFoundException() : base(DefaultMessage) { }
/// 表示目标资源不存在的错误。
/// 默认消息:Operation is not authorized.
public NotFoundException(string message) : base(FixMessage(message)) { }
/// 表示目标资源不存在的错误。
/// 默认消息:Operation is not authorized.
public NotFoundException(string message, Exception innerException) : base(FixMessage(message), innerException) { }
}
}