MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
445 stars 155 forks source link

Add error trapping when a call to the API makes it to _callAPI without account being set #304

Closed jhoneill closed 4 years ago

jhoneill commented 4 years ago

Currently if a the calling function does not do it's own check for _getInstance, or by looking at [VSTeamVersions]::account, and dives into _call API an error is thrown that "relative URLs are not supported " because the URL is built without the protocol and host name.

I've added something to catch this and give a specific error.

SebastianSchuetze commented 4 years ago

@jhoneill you are confusing me a bit here. You linked a commit from your repository. Is there a PR containing this change? In the same commit, you also edited something else. Can you clarify or link the PR here if it already exists?

SebastianSchuetze commented 4 years ago

found it myself.

DarqueWarrior commented 4 years ago

This looks like a regression. I will see what happened. Thanks for reporting this.

DarqueWarrior commented 4 years ago

The call to _hasAccount used to be called in _buildRequestURI that is called but _callAPI and it is missing. I will review the history of the project and track down when that got broken. Then I will decide where we return it.

DarqueWarrior commented 4 years ago

This was caused by the changes to remove the dynamic parameters. _buildRequestURI was changed and _hasAccount removed from the method. I did not notice this in the changes coming in. I am putting the code in _buildRequestURI back the way it was.