• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン5022f8c707175d9d8cd0c38915e52b1fffd92271 (tree)
日時2011-01-29 13:39:42
作者azyobuzin <azyobuzin@user...>
コミッターazyobuzin

ログメッセージ

・エラー処理するようにした
・LINQ To Twitterを更新 -> To r84159

変更サマリ

  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/DirectMessagesTimelineTabPage.cs"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/HomeTimelineTabPage.cs"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/MentionsTabPage.cs"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/Forms/MainForm.cs"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/ITwirunrunMainForm.cs"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/Settings/Settings.cs"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitter.dll"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitter.pdb"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitterAg.dll"
  • delete: "\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitterAg.pdb"

差分

--- "a/\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/DirectMessagesTimelineTabPage.cs"
+++ "b/\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/DirectMessagesTimelineTabPage.cs"
@@ -29,19 +29,25 @@ namespace Azyobuzi.Twirunrun
2929 public override void RefreshTimeline(int page, int count, bool first)
3030 {
3131 NotifyStarted();
32- var newDMs = new[] { DirectMessageType.SentTo, DirectMessageType.SentBy }.SelectMany(type =>
33- this.GetMainForm().TwitterContext.DirectMessage.Where(dm =>
34- dm.Type == type &&
35- dm.Page == page &&
36- dm.Count == count
37- )
38- ).Select(dm => new StatusInfo(dm))
39- .Where(dm => !RecentStatusesCollection.Instance.AsParallel().Contains(dm))
40- .ToArray();
41- if (newDMs.Any())
42- this.first = first;
43- RecentStatusesCollection.Instance.AddRange(newDMs);
44- NotifyCompleted();
32+ try
33+ {
34+ var newDMs = new[] { DirectMessageType.SentTo, DirectMessageType.SentBy }.SelectMany(type =>
35+ this.GetMainForm().TwitterContext.DirectMessage.Where(dm =>
36+ dm.Type == type &&
37+ dm.Page == page &&
38+ dm.Count == count
39+ )
40+ ).Select(dm => new StatusInfo(dm))
41+ .Where(dm => !RecentStatusesCollection.Instance.AsParallel().Contains(dm))
42+ .ToArray();
43+ if (newDMs.Any())
44+ this.first = first;
45+ RecentStatusesCollection.Instance.AddRange(newDMs);
46+ }
47+ finally
48+ {
49+ NotifyCompleted();
50+ }
4551 }
4652 }
4753 }
--- "a/\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/HomeTimelineTabPage.cs"
+++ "b/\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/HomeTimelineTabPage.cs"
@@ -30,18 +30,24 @@ namespace Azyobuzi.Twirunrun
3030 public override void RefreshTimeline(int page, int count, bool first)
3131 {
3232 NotifyStarted();
33- var newTweets = this.GetMainForm().TwitterContext.Status.Where(tweet =>
34- tweet.Type == StatusType.Home &&
35- tweet.Page == page &&
36- tweet.Count == count
37- )
38- .Select(tweet => new StatusInfo(tweet))
39- .Where(tweet => !RecentStatusesCollection.Instance.AsParallel().Contains(tweet))
40- .ToArray();
41- if (newTweets.Any())
42- this.first = first;
43- RecentStatusesCollection.Instance.AddRange(newTweets);
44- NotifyCompleted();
33+ try
34+ {
35+ var newTweets = this.GetMainForm().TwitterContext.Status.Where(tweet =>
36+ tweet.Type == StatusType.Home &&
37+ tweet.Page == page &&
38+ tweet.Count == count
39+ )
40+ .Select(tweet => new StatusInfo(tweet))
41+ .Where(tweet => !RecentStatusesCollection.Instance.AsParallel().Contains(tweet))
42+ .ToArray();
43+ if (newTweets.Any())
44+ this.first = first;
45+ RecentStatusesCollection.Instance.AddRange(newTweets);
46+ }
47+ finally
48+ {
49+ NotifyCompleted();
50+ }
4551 }
4652 }
4753 }
--- "a/\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/MentionsTabPage.cs"
+++ "b/\202\302\202\242\202\351\202\361\202\351\202\361/Controls/Tabs/MentionsTabPage.cs"
@@ -38,18 +38,24 @@ namespace Azyobuzi.Twirunrun
3838 public override void RefreshTimeline(int page, int count, bool first)
3939 {
4040 NotifyStarted();
41- var newTweets = this.GetMainForm().TwitterContext.Status.Where(tweet =>
42- tweet.Type == StatusType.Mentions &&
43- tweet.Page == page &&
44- tweet.Count == count
45- )
46- .Select(tweet => new StatusInfo(tweet))
47- .Where(tweet => !RecentStatusesCollection.Instance.AsParallel().Contains(tweet))
48- .ToArray();
49- if (newTweets.Any())
50- this.first = first;
51- RecentStatusesCollection.Instance.AddRange(newTweets);
52- NotifyCompleted();
41+ try
42+ {
43+ var newTweets = this.GetMainForm().TwitterContext.Status.Where(tweet =>
44+ tweet.Type == StatusType.Mentions &&
45+ tweet.Page == page &&
46+ tweet.Count == count
47+ )
48+ .Select(tweet => new StatusInfo(tweet))
49+ .Where(tweet => !RecentStatusesCollection.Instance.AsParallel().Contains(tweet))
50+ .ToArray();
51+ if (newTweets.Any())
52+ this.first = first;
53+ RecentStatusesCollection.Instance.AddRange(newTweets);
54+ }
55+ finally
56+ {
57+ NotifyCompleted();
58+ }
5359 }
5460 }
5561 }
--- "a/\202\302\202\242\202\351\202\361\202\351\202\361/Forms/MainForm.cs"
+++ "b/\202\302\202\242\202\351\202\361\202\351\202\361/Forms/MainForm.cs"
@@ -9,6 +9,7 @@ using LinqToTwitter;
99 using System.Diagnostics;
1010 using System.Threading;
1111 using System.Threading.Tasks;
12+using System.Net;
1213
1314 namespace Azyobuzi.Twirunrun
1415 {
@@ -151,7 +152,11 @@ namespace Azyobuzi.Twirunrun
151152
152153 public void RefreshTimelines(IEnumerable<TimelineTabPage> tabs, bool first)
153154 {
154- var t = new Thread(() => tabs.AsParallel().ForAll(tab => tab.RefreshTimeline(first)));
155+ var t = new Thread(() =>
156+ tabs.AsParallel().ForAll(tab =>
157+ ((Action)(() => tab.RefreshTimeline(first)))
158+ .TryCatch(ex => ShowError(tab, ex))
159+ ));
155160 t.IsBackground = true;
156161 t.Start();
157162 }
@@ -230,5 +235,41 @@ namespace Azyobuzi.Twirunrun
230235 {
231236 notifyIcon1.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon);
232237 }
238+
239+
240+ public void ShowError(TimelineTabPage tabPage, Exception exception)
241+ {
242+ string message;
243+ Exception ex =
244+ exception.InnerException == null && exception.InnerException is TwitterQueryException
245+ ? exception : exception.InnerException;
246+ var twitterex = ex as TwitterQueryException;
247+ if (twitterex != null)
248+ {
249+ if (twitterex.Response.Error == "See Inner Exception Details for more information." ||
250+ twitterex.Response.Error == "error message not received from Twitter")
251+ {
252+ var webex = twitterex.InnerException as WebException;
253+ if (webex == null)
254+ {
255+ message = "不明なエラー";
256+ }
257+ else
258+ {
259+ var statuscode = ((HttpWebResponse)webex.Response).StatusCode;
260+ message = string.Format("{0} {1}", (int)statuscode, statuscode.ToString());
261+ }
262+ }
263+ else
264+ {
265+ message = twitterex.Response.Error;
266+ }
267+ }
268+ else
269+ {
270+ message = ex.Message;
271+ }
272+ StatusChange(string.Format("{0}:{1}", tabPage.TabSettings.Name, message));
273+ }
233274 }
234275 }
--- "a/\202\302\202\242\202\351\202\361\202\351\202\361/ITwirunrunMainForm.cs"
+++ "b/\202\302\202\242\202\351\202\361\202\351\202\361/ITwirunrunMainForm.cs"
@@ -1,4 +1,5 @@
1-using System.Collections.Generic;
1+using System;
2+using System.Collections.Generic;
23 using System.Windows.Forms;
34 using LinqToTwitter;
45
@@ -13,5 +14,6 @@ namespace Azyobuzi.Twirunrun
1314 IEnumerable<TimelineTabPage> GetTabPages();
1415 void RefreshTimelines(IEnumerable<TimelineTabPage> tabs, bool first);
1516 void ShowBalloon(int timeout, string tipTitle, string tipText, ToolTipIcon tipIcon);
17+ void ShowError(TimelineTabPage tabPage, Exception exception);
1618 }
1719 }
--- "a/\202\302\202\242\202\351\202\361\202\351\202\361/Settings/Settings.cs"
+++ "b/\202\302\202\242\202\351\202\361\202\351\202\361/Settings/Settings.cs"
@@ -534,7 +534,7 @@ namespace Azyobuzi.Twirunrun
534534 //
535535 //投稿欄の位置
536536 //
537- private DockStyle postPanelPosition = DockStyle.Bottom;
537+ private DockStyle postPanelPosition = DockStyle.Top;
538538 public DockStyle PostPanelPosition
539539 {
540540 set
Binary files "a/\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitter.dll" and "b/\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitter.dll" differ
Binary files "a/\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitter.pdb" and "b/\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitter.pdb" differ
Binary files "a/\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitterAg.dll" and /dev/null differ
Binary files "a/\202\302\202\242\202\351\202\361\202\351\202\361/lib/LinqToTwitterAg.pdb" and /dev/null differ