コード例 #1
0
ファイル: ObixError.cs プロジェクト: wbrussell/NetBIX
 public ObixError(Type @Type, int ErrorCode)
 {
     this.Type            = Type;
     this.ErrorCode       = ErrorCode;
     this.AuxErrorMessage = ObixResult.Message(ErrorCode);
     this.ErrorDate       = DateTime.UtcNow;
 }
コード例 #2
0
ファイル: ObixError.cs プロジェクト: wbrussell/NetBIX
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            if (this.Exception == null)
            {
                sb.AppendFormat("[{3} - {0}] Error {1}: {2}", this.ErrorDate.ToLocalTime(), this.ErrorCode, ObixResult.Message(this.ErrorCode), this.Type.ToString());
                if (string.IsNullOrEmpty(this.AuxErrorMessage) == false)
                {
                    sb.AppendFormat(" ({0}: {1})", this.AuxErrorCode, this.AuxErrorMessage);
                }
            }
            else
            {
                sb.AppendFormat("[{3} - {0}] Exception {1}: {2}", this.ErrorDate, this.ErrorCode, this.Exception.GetType().ToString(), this.Exception.Message);
            }
            return(sb.ToString());
        }