using HttpRequestHeader = System.Net.HttpRequestHeader;
using HMACSHA1 = System.Security.Cryptography.HMACSHA1;
using Encoding = System.Text.Encoding;
+using System;
namespace OpenTween
{
{
// PIN-based flow
if ( string.IsNullOrEmpty( requestToken ) )
- throw new Exception( "Sequence error.(requestToken is blank)" );
+ throw new InvalidOperationException( "Sequence error.(requestToken is blank)" );
// アクセストークン取得
string content = "";
public HttpStatusCode AuthenticateXAuth( Uri accessTokenUrl, string username, string password, ref string content )
{
// ユーザー・パスワードチェック
- if ( string.IsNullOrEmpty( username ) || string.IsNullOrEmpty( password ) )
- throw new Exception( "Sequence error.(username or password is blank)" );
+ if ( string.IsNullOrEmpty( username ) )
+ throw new ArgumentException( "username is null or empty", "username" );
+ if ( string.IsNullOrEmpty( password ) )
+ throw new ArgumentException( "password is null or empty", "password" );
// xAuthの拡張パラメータ設定
Dictionary< string, string > parameter = new Dictionary< string, string >();
case DialogResult.No:
return false;
case DialogResult.Cancel:
- return IsTerminatePermission;
default:
- throw new Exception("");
+ return IsTerminatePermission;
}
}
}
hotkeyID = GlobalAddAtom(atomName);
if (hotkeyID == 0)
{
- throw new Exception("Unable to generate unique hotkey ID. Error code: " +
- Marshal.GetLastWin32Error().ToString());
+ throw new Win32Exception();
}
// register the hotkey, throw if any error
if (RegisterHotKey(targetForm.Handle, hotkeyID, modifiers, hotkeyValue) == 0)
{
- throw new Exception("Unable to register hotkey. Error code: " +
- Marshal.GetLastWin32Error().ToString());
+ throw new Win32Exception();
}
return hotkeyID;
}
{
tab.TabType = MyCommon.TabUsageType.UserDefined;
}
- if (!AddNewTab(tab.TabName, true, tab.TabType, tab.ListInfo)) throw new Exception(Properties.Resources.TweenMain_LoadText1);
+ if (!AddNewTab(tab.TabName, true, tab.TabType, tab.ListInfo))
+ throw new TabException(Properties.Resources.TweenMain_LoadText1);
}
this.JumpReadOpMenuItem.ShortcutKeyDisplayString = "Space";