OSDN Git Service
(root)
/
opentween
/
open-tween.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e69c439
)
投稿サービスのエラー処理を微調整
author
spx
<spx268@gmail.com>
Wed, 1 Jul 2015 14:09:01 +0000
(23:09 +0900)
committer
Kimura Youichi
<kim.upsilon@bucyou.net>
Sat, 4 Jul 2015 03:11:23 +0000
(12:11 +0900)
OpenTween/Connection/Imgur.cs
patch
|
blob
|
history
OpenTween/Connection/Mobypicture.cs
patch
|
blob
|
history
OpenTween/Connection/TwipplePhoto.cs
patch
|
blob
|
history
OpenTween/Connection/TwitterPhoto.cs
patch
|
blob
|
history
OpenTween/Connection/imgly.cs
patch
|
blob
|
history
OpenTween/Connection/yfrog.cs
patch
|
blob
|
history
diff --git
a/OpenTween/Connection/Imgur.cs
b/OpenTween/Connection/Imgur.cs
index
6f9b2a5
..
37b698d
100644
(file)
--- a/
OpenTween/Connection/Imgur.cs
+++ b/
OpenTween/Connection/Imgur.cs
@@
-95,6
+95,9
@@
namespace OpenTween.Connection
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
+ if (mediaItems == null)
+ throw new ArgumentNullException("mediaItems");
+
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
@@
-104,7
+107,7
@@
namespace OpenTween.Connection
throw new NotImplementedException();
if (!item.Exists)
throw new NotImplementedException();
if (!item.Exists)
- throw new ArgumentException("
File isn't exists.", "mediaItems[0]
");
+ throw new ArgumentException("
Err:Media not found.
");
XDocument xml;
try
XDocument xml;
try
diff --git
a/OpenTween/Connection/Mobypicture.cs
b/OpenTween/Connection/Mobypicture.cs
index
5ba48c1
..
524feb4
100644
(file)
--- a/
OpenTween/Connection/Mobypicture.cs
+++ b/
OpenTween/Connection/Mobypicture.cs
@@
-124,13
+124,19
@@
namespace OpenTween.Connection
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
+ if (mediaItems == null)
+ throw new ArgumentNullException("mediaItems");
+
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
+ if (item == null)
+ throw new ArgumentException("Err:Media not specified.");
+
if (!item.Exists)
if (!item.Exists)
- throw new ArgumentException("Err:
File isn't exists.", "filePaths[0]
");
+ throw new ArgumentException("Err:
Media not found.
");
var xml = await this.mobypictureApi.UploadFileAsync(item, text)
.ConfigureAwait(false);
var xml = await this.mobypictureApi.UploadFileAsync(item, text)
.ConfigureAwait(false);
diff --git
a/OpenTween/Connection/TwipplePhoto.cs
b/OpenTween/Connection/TwipplePhoto.cs
index
ee27035
..
5415ca7
100644
(file)
--- a/
OpenTween/Connection/TwipplePhoto.cs
+++ b/
OpenTween/Connection/TwipplePhoto.cs
@@
-104,13
+104,19
@@
namespace OpenTween.Connection
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
+ if (mediaItems == null)
+ throw new ArgumentNullException("mediaItems");
+
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
+ if (item == null)
+ throw new ArgumentException("Err:Media not specified.");
+
if (!item.Exists)
if (!item.Exists)
- throw new ArgumentException("Err:
File isn't exists.", "filePaths[0]
");
+ throw new ArgumentException("Err:
Media not found.
");
var xml = await this.twippleApi.UploadFileAsync(item)
.ConfigureAwait(false);
var xml = await this.twippleApi.UploadFileAsync(item)
.ConfigureAwait(false);
diff --git
a/OpenTween/Connection/TwitterPhoto.cs
b/OpenTween/Connection/TwitterPhoto.cs
index
63e1046
..
17c7264
100644
(file)
--- a/
OpenTween/Connection/TwitterPhoto.cs
+++ b/
OpenTween/Connection/TwitterPhoto.cs
@@
-78,16
+78,19
@@
namespace OpenTween.Connection
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
- if (mediaItems == null || mediaItems.Length == 0)
- throw new ArgumentException("Err:Media isn't specified.", "mediaItems");
+ if (mediaItems == null)
+ throw new ArgumentNullException("mediaItems");
+
+ if (mediaItems.Length == 0)
+ throw new ArgumentException("Err:Media not specified.");
foreach (var item in mediaItems)
{
if (item == null)
foreach (var item in mediaItems)
{
if (item == null)
- throw new ArgumentException("Err:Media
isn't specified.", "mediaItems
");
+ throw new ArgumentException("Err:Media
not specified.
");
if (!item.Exists)
if (!item.Exists)
- throw new ArgumentException("Err:
File isn't exists.", "mediaItems
");
+ throw new ArgumentException("Err:
Media not found.
");
}
await Task.Run(() =>
}
await Task.Run(() =>
diff --git
a/OpenTween/Connection/imgly.cs
b/OpenTween/Connection/imgly.cs
index
5ae8f8d
..
79a1d49
100644
(file)
--- a/
OpenTween/Connection/imgly.cs
+++ b/
OpenTween/Connection/imgly.cs
@@
-87,13
+87,19
@@
namespace OpenTween.Connection
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
+ if (mediaItems == null)
+ throw new ArgumentNullException("mediaItems");
+
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
+ if (item == null)
+ throw new ArgumentException("Err:Media not specified.");
+
if (!item.Exists)
if (!item.Exists)
- throw new ArgumentException("Err:
File isn't exists.", "filePaths[0]
");
+ throw new ArgumentException("Err:
Media not found.
");
var xml = await this.imglyApi.UploadFileAsync(item, text)
.ConfigureAwait(false);
var xml = await this.imglyApi.UploadFileAsync(item, text)
.ConfigureAwait(false);
diff --git
a/OpenTween/Connection/yfrog.cs
b/OpenTween/Connection/yfrog.cs
index
9c766ae
..
af22d5d
100644
(file)
--- a/
OpenTween/Connection/yfrog.cs
+++ b/
OpenTween/Connection/yfrog.cs
@@
-87,13
+87,19
@@
namespace OpenTween.Connection
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
+ if (mediaItems == null)
+ throw new ArgumentNullException("mediaItems");
+
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
+ if (item == null)
+ throw new ArgumentException("Err:Media not specified.");
+
if (!item.Exists)
if (!item.Exists)
- throw new ArgumentException("Err:
File isn't exists.", "filePaths[0]
");
+ throw new ArgumentException("Err:
Media not found.
");
var xml = await this.yfrogApi.UploadFileAsync(item, text)
.ConfigureAwait(false);
var xml = await this.yfrogApi.UploadFileAsync(item, text)
.ConfigureAwait(false);