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.

31 lines
789 B

using System;
using System.Collections.Generic;
using System.Text;
namespace Apewer.Web
{
/// <summary>表示在 API 执行过程中发生的错误。</summary>
public sealed class ApiException : Exception
{
string _status = null;
/// <summary>表示 API 状态。</summary>
public string Status { get { return _status; } }
internal ApiException(string message, string status = "exception") : base(FixMessage(message))
{
_status = status;
}
static string FixMessage(string message)
{
var msg = TextUtility.Trim(message);
if (string.IsNullOrEmpty(msg)) msg = "在执行 API 的过程中发生了未定义消息的错误。";
return msg;
}
}
}