@@ -255,10 +255,19 @@ public List<PSResourceInfo> FindTag(
255
255
return foundPackages ;
256
256
}
257
257
258
- // Error out if repository array of names to be searched contains wildcards.
259
258
if ( repository != null )
260
259
{
261
260
repository = Utils . ProcessNameWildcards ( repository , removeWildcardEntries : false , out string [ ] errorMsgs , out _repositoryNameContainsWildcard ) ;
261
+
262
+ if ( string . Equals ( repository [ 0 ] , '*' ) )
263
+ {
264
+ _cmdletPassedIn . ThrowTerminatingError ( new ErrorRecord (
265
+ new PSArgumentException ( "-Repository parameter does not support entry '*'." ) ,
266
+ "RepositoryDoesNotSupportWildcardEntry" ,
267
+ ErrorCategory . InvalidArgument ,
268
+ this ) ) ;
269
+ }
270
+
262
271
foreach ( string error in errorMsgs )
263
272
{
264
273
_cmdletPassedIn . WriteError ( new ErrorRecord (
@@ -274,6 +283,15 @@ public List<PSResourceInfo> FindTag(
274
283
try
275
284
{
276
285
repositoriesToSearch = RepositorySettings . Read ( repository , out string [ ] errorList ) ;
286
+ if ( repository != null && repositoriesToSearch . Count == 0 )
287
+ {
288
+ _cmdletPassedIn . ThrowTerminatingError ( new ErrorRecord (
289
+ new PSArgumentException ( "Cannot resolve -Repository name. Run 'Get-PSResourceRepository' to view all registered repositories." ) ,
290
+ "RepositoryNameIsNotResolved" ,
291
+ ErrorCategory . InvalidArgument ,
292
+ this ) ) ;
293
+ }
294
+
277
295
foreach ( string error in errorList )
278
296
{
279
297
_cmdletPassedIn . WriteError ( new ErrorRecord (
0 commit comments