OSDN Git Service

設定画面の画面表示の不具合を修正,
[wptscs/wpts.git] / Wptscs / Logics / Logger.cs
index 5d2b3f0..70f297e 100644 (file)
@@ -11,6 +11,7 @@
 namespace Honememo.Wptscs.Logics
 {
     using System;
+    using System.Net;
     using System.Text;
     using Honememo.Parsers;
     using Honememo.Utilities;
@@ -109,6 +110,21 @@ namespace Honememo.Wptscs.Logics
         }
 
         /// <summary>
+        /// 例外メッセージ(「→ 通信エラー」のようなメッセージ)を登録する。
+        /// </summary>
+        /// <param name="e">例外。</param>
+        public virtual void AddError(Exception e)
+        {
+            // 応答形式で例外メッセージを出力
+            this.AddResponse(e.Message);
+            if (e is WebException && ((WebException)e).Response != null)
+            {
+                // 出せるならエラーとなったURLも出力
+                this.AddResponse(Resources.LogMessageErrorURL, ((WebException)e).Response.ResponseUri);
+            }
+        }
+
+        /// <summary>
         /// ログ上の区切りを登録する。
         /// </summary>
         public virtual void AddSeparator()