using System; using System.Collections.Generic; using System.Text; namespace Apewer.Web { /// 表示在 API 执行过程中发生的错误。 public sealed class ApiException : Exception { string _status = null; /// 表示 API 状态。 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; } } }