[Modify] Throw an exception if read-only

This commit is contained in:
sta 2019-04-22 14:15:17 +09:00
parent 449e38c239
commit e111cc2ee2

View File

@ -628,11 +628,19 @@ namespace WebSocketSharp.Net
/// <param name="cookies">
/// A <see cref="CookieCollection"/> that contains the cookies to add.
/// </param>
/// <exception cref="InvalidOperationException">
/// The collection is read-only.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="cookies"/> is <see langword="null"/>.
/// </exception>
public void Add (CookieCollection cookies)
{
if (_readOnly) {
var msg = "The collection is read-only.";
throw new InvalidOperationException (msg);
}
if (cookies == null)
throw new ArgumentNullException ("cookies");