Venafi / VenafiPS

Powershell module to fully automate your Venafi TLS Protect Datacenter and Cloud platforms!
https://venafips.readthedocs.io/
Apache License 2.0
18 stars 7 forks source link

Should return null instead of an error when search result is empty #170

Closed stevekeever closed 1 year ago

stevekeever commented 1 year ago

Environment

Operating System: Windows 10
VenafiPS version: 5.2.1
PowerShell version: 5.1
TPP version (if applicable): 21.4

When calling both Get-VenafiTeam and ConvertTo-TppGuid, if the calling object does not exist, it would be preferred that the function returns null instead of an "Object Does Not Exist" error.

wilddev65 commented 1 year ago

I agree with you about ConvertTo-TppGuid, but I'm scratching my head about Get-VenafiTeam. Looking at the API, it seems there are quite a few distinct errors that could be returned by GET Teams and that you would want to know the team is missing, not just get null back. Can you explain this a bit more?

gdbarron commented 1 year ago

I think it's best to come up with a standard and go with it for all for a specific type of function. In prior conversations, folks have talked about Get functions returning null/nothing when an item doesn't exist. But, there are times to return an error, eg. when the format of the value provided isn't correct. You could also return the error with verbose output, but function output is null. Lots of ways to handle it, but I'd suggest coming up with a standard and sticking with it.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 30 days since being marked as stale.