You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.6 KiB
46 lines
1.6 KiB
using Apewer.Web;
|
|
using System;
|
|
|
|
namespace Apewer
|
|
{
|
|
|
|
/// <summary>表示目标资源不存在的错误。</summary>
|
|
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;
|
|
}
|
|
|
|
/// <summary>获取或设置默认消息。</summary>
|
|
public static string DefaultMessage { get => _default; set => _default = FixMessage(value); }
|
|
|
|
/// <summary>状态。</summary>
|
|
/// <value>Unauthorized</value>
|
|
public virtual string Status { get => "Not Found"; }
|
|
|
|
/// <summary>表示目标资源不存在的错误。</summary>
|
|
/// <remarks>默认消息:Operation is not authorized.</remarks>
|
|
public NotFoundException() : base(DefaultMessage) { }
|
|
|
|
/// <summary>表示目标资源不存在的错误。</summary>
|
|
/// <remarks>默认消息:Operation is not authorized.</remarks>
|
|
public NotFoundException(string message) : base(FixMessage(message)) { }
|
|
|
|
/// <summary>表示目标资源不存在的错误。</summary>
|
|
/// <remarks>默认消息:Operation is not authorized.</remarks>
|
|
public NotFoundException(string message, Exception innerException) : base(FixMessage(message), innerException) { }
|
|
|
|
}
|
|
|
|
}
|