Skip to content

Throw exception on a simple use-case #2

@vors

Description

@vors

I created file with content

function Download-File($url, $file) {
    $webclient = New-Object System.Net.WebClient
    $webclient.DownloadFile($url,$file)
}

Run Document cmdlet and get this error message

image

Message text:

---------------------------
Sublime Text
---------------------------
get-command : The term 'Download-File' is not recognized as the name of a 
cmdlet, function, script file, or operable program. Check the spelling of the 
name, or if a path was included, verify that the path is correct and try again.
At C:\Users\sevoroby\AppData\Roaming\Sublime Text 3\Packages\Powershell Help 
Generator\Get-HelpTemplate.ps1:5 char:6
+ $c = get-command $commandName
+      ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Download-File:String) [Get-Comm 
   and], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Co 
   mmands.GetCommandCommand

Cannot index into a null array.
At C:\Users\sevoroby\AppData\Roaming\Sublime Text 3\Packages\Powershell Help 
Generator\Get-HelpTemplate.ps1:24 char:5
+     $parameter = $c.Parameters[$_]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\sevoroby\AppData\Roaming\Sublime Text 3\Packages\Powershell Help 
Generator\Get-HelpTemplate.ps1:25 char:5
+     $parameters += $c.Parameters[$_]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray


---------------------------
OK   
---------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions