Skip to content

Commit 4b642bf

Browse files
VLADVLAD
VLAD
authored and
VLAD
committed
Exception parameters have been added.
1 parent d586eb0 commit 4b642bf

File tree

5 files changed

+49
-49
lines changed

5 files changed

+49
-49
lines changed

FastSearchLibrary/DirectorySearcher/DirectorySearcher.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,39 +188,39 @@ public DirectorySearcher(string folder, Func<DirectoryInfo, bool> isValid, Cance
188188
private void CheckFolder(string folder)
189189
{
190190
if (folder == null)
191-
throw new ArgumentNullException("Argument \"folder\" is null.");
191+
throw new ArgumentNullException(nameof(folder), "Argument is null.");
192192

193193
if (folder == String.Empty)
194-
throw new ArgumentException("Argument \"folder\" is not valid.");
194+
throw new ArgumentException("Argument is not valid.", nameof(folder));
195195

196196
DirectoryInfo dir = new DirectoryInfo(folder);
197197

198198
if (!dir.Exists)
199-
throw new ArgumentException("Argument \"folder\" does not represent an existing directory.");
199+
throw new ArgumentException("Argument does not represent an existing directory.", nameof(folder));
200200
}
201201

202202

203203
private void CheckPattern(string pattern)
204204
{
205205
if (pattern == null)
206-
throw new ArgumentNullException("Argument \"pattern\" is null.");
206+
throw new ArgumentNullException(nameof(pattern), "Argument is null.");
207207

208208
if (pattern == String.Empty)
209-
throw new ArgumentException("Argument \"pattern\" is not valid.");
209+
throw new ArgumentException("Argument is not valid.", nameof(pattern));
210210
}
211211

212212

213213
private void CheckDelegate(Func<DirectoryInfo, bool> isValid)
214214
{
215215
if (isValid == null)
216-
throw new ArgumentNullException("Argument \"isValid\" is null.");
216+
throw new ArgumentNullException(nameof(isValid), "Argument is null.");
217217
}
218218

219219

220220
private void CheckTokenSource(CancellationTokenSource tokenSource)
221221
{
222222
if (tokenSource == null)
223-
throw new ArgumentNullException("Argument \"tokenSource\" is null.");
223+
throw new ArgumentNullException(nameof(tokenSource), "Argument \"tokenSource\" is null.");
224224
}
225225

226226
#endregion

FastSearchLibrary/DirectorySearcher/DirectorySearcherMultiple.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -211,42 +211,42 @@ public DirectorySearcherMultiple(List<string> folders, CancellationTokenSource t
211211
#region Checking methods
212212

213213
private void CheckFolder(string folder)
214-
{
215-
if (folder == null)
216-
throw new ArgumentNullException("Argument \"folder\" is null.");
214+
{
215+
if (folder == null)
216+
throw new ArgumentNullException(nameof(folder), "Argument is null.");
217217

218-
if (folder == String.Empty)
219-
throw new ArgumentException("Argument \"folder\" is not valid.");
218+
if (folder == String.Empty)
219+
throw new ArgumentException("Argument is not valid.", nameof(folder));
220220

221-
DirectoryInfo dir = new DirectoryInfo(folder);
221+
DirectoryInfo dir = new DirectoryInfo(folder);
222222

223-
if (!dir.Exists)
224-
throw new ArgumentException("Argument \"folder\" does not represent an existing directory.");
225-
}
223+
if (!dir.Exists)
224+
throw new ArgumentException("Argument does not represent an existing directory.", nameof(folder));
225+
}
226226

227227

228-
private void CheckPattern(string pattern)
229-
{
230-
if (pattern == null)
231-
throw new ArgumentNullException("Argument \"pattern\" is null.");
228+
private void CheckPattern(string pattern)
229+
{
230+
if (pattern == null)
231+
throw new ArgumentNullException(nameof(pattern), "Argument is null.");
232232

233-
if (pattern == String.Empty)
234-
throw new ArgumentException("Argument \"pattern\" is not valid.");
235-
}
233+
if (pattern == String.Empty)
234+
throw new ArgumentException("Argument is not valid.", nameof(pattern));
235+
}
236236

237237

238-
private void CheckDelegate(Func<DirectoryInfo, bool> isValid)
239-
{
240-
if (isValid == null)
241-
throw new ArgumentNullException("Argument \"isValid\" is null.");
242-
}
238+
private void CheckDelegate(Func<DirectoryInfo, bool> isValid)
239+
{
240+
if (isValid == null)
241+
throw new ArgumentNullException(nameof(isValid), "Argument is null.");
242+
}
243243

244244

245-
private void CheckTokenSource(CancellationTokenSource tokenSource)
246-
{
247-
if (tokenSource == null)
248-
throw new ArgumentNullException("Argument \"tokenSource\" is null.");
249-
}
245+
private void CheckTokenSource(CancellationTokenSource tokenSource)
246+
{
247+
if (tokenSource == null)
248+
throw new ArgumentNullException(nameof(tokenSource), "Argument is null.");
249+
}
250250

251251
#endregion
252252

FastSearchLibrary/FileSearcher/FileSearcher.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,39 +265,39 @@ public FileSearcher(string folder, Func<FileInfo, bool> isValid, CancellationTok
265265
private void CheckFolder(string folder)
266266
{
267267
if (folder == null)
268-
throw new ArgumentNullException("Argument \"folder\" is null.");
268+
throw new ArgumentNullException(nameof(folder), "Argument is null.");
269269

270270
if (folder == String.Empty)
271-
throw new ArgumentException("Argument \"folder\" is not valid.");
271+
throw new ArgumentException("Argument is not valid.", nameof(folder));
272272

273273
DirectoryInfo dir = new DirectoryInfo(folder);
274274

275275
if (!dir.Exists)
276-
throw new ArgumentException("Argument \"folder\" does not represent an existing directory.");
276+
throw new ArgumentException("Argument does not represent an existing directory.", nameof(folder));
277277
}
278278

279279

280280
private void CheckPattern(string pattern)
281281
{
282282
if (pattern == null)
283-
throw new ArgumentNullException("Argument \"pattern\" is null.");
283+
throw new ArgumentNullException(nameof(pattern), "Argument is null.");
284284

285285
if (pattern == String.Empty)
286-
throw new ArgumentException("Argument \"pattern\" is not valid.");
286+
throw new ArgumentException("Argument is not valid.", nameof(pattern));
287287
}
288288

289289

290290
private void CheckDelegate(Func<FileInfo, bool> isValid)
291291
{
292292
if (isValid == null)
293-
throw new ArgumentNullException("Argument \"isValid\" is null.");
293+
throw new ArgumentNullException(nameof(isValid), "Argument is null.");
294294
}
295295

296296

297297
private void CheckTokenSource(CancellationTokenSource tokenSource)
298298
{
299299
if (tokenSource == null)
300-
throw new ArgumentNullException("Argument \"tokenSource\" is null.");
300+
throw new ArgumentNullException(nameof(tokenSource), "Argument is null.");
301301
}
302302

303303

FastSearchLibrary/FileSearcher/FileSearcherMultiple.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,39 +210,39 @@ public FileSearcherMultiple(List<string> folders, CancellationTokenSource tokenS
210210
private void CheckFolder(string folder)
211211
{
212212
if (folder == null)
213-
throw new ArgumentNullException("Argument \"folder\" is null.");
213+
throw new ArgumentNullException(nameof(folder), "Argument is null.");
214214

215215
if (folder == String.Empty)
216-
throw new ArgumentException("Argument \"folder\" is not valid.");
216+
throw new ArgumentException("Argument is not valid.", nameof(folder));
217217

218218
DirectoryInfo dir = new DirectoryInfo(folder);
219219

220220
if (!dir.Exists)
221-
throw new ArgumentException("Argument \"folder\" does not represent an existing directory.");
221+
throw new ArgumentException("Argument does not represent an existing directory.", nameof(folder));
222222
}
223223

224224

225225
private void CheckPattern(string pattern)
226226
{
227227
if (pattern == null)
228-
throw new ArgumentNullException("Argument \"pattern\" is null.");
228+
throw new ArgumentNullException(nameof(pattern), "Argument is null.");
229229

230230
if (pattern == String.Empty)
231-
throw new ArgumentException("Argument \"pattern\" is not valid.");
231+
throw new ArgumentException("Argument is not valid.", nameof(pattern));
232232
}
233233

234234

235235
private void CheckDelegate(Func<FileInfo, bool> isValid)
236236
{
237237
if (isValid == null)
238-
throw new ArgumentNullException("Argument \"isValid\" is null.");
238+
throw new ArgumentNullException(nameof(isValid), "Argument is null.");
239239
}
240240

241241

242242
private void CheckTokenSource(CancellationTokenSource tokenSource)
243243
{
244244
if (tokenSource == null)
245-
throw new ArgumentNullException("Argument \"tokenSource\" is null.");
245+
throw new ArgumentNullException(nameof(tokenSource), "Argument is null.");
246246
}
247247

248248

FastSearchLibrary/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.1.5.1")]
36-
[assembly: AssemblyFileVersion("1.1.5.1")]
35+
[assembly: AssemblyVersion("1.1.6.0")]
36+
[assembly: AssemblyFileVersion("1.1.6.0")]

0 commit comments

Comments
 (0)