Skip to content

hotfix for #4932 to show better error message #4933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 24, 2025
Merged

Conversation

wuxiaojun514
Copy link
Contributor

Before creating a pull request, make sure that you have read the contribution file located at

https://github.com/pnp/powerShell/blob/dev/CONTRIBUTING.md

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #4932

What is in this Pull Request ?

Right now if you want to use Get-PnPTerm -Recursive command to get not-existing term, you will get the following error message, which is not clear enough.

Get-PnPTerm: Value cannot be null. (Parameter 'clientObject')

The root casue is that if term is null, the clientContext.Load(term, expressions); will throw this Value cannot be null. (Parameter 'clientObject') error, so I added a check to better show the error message

I tested this hotfix with/without Recursive switch, it will always show "The specified term does not exist" error message

@gautamdsheth gautamdsheth merged commit 983f909 into pnp:dev May 24, 2025
3 of 4 checks passed
@gautamdsheth
Copy link
Collaborator

Thanks @wuxiaojun514 , much appreciated the fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] It will throw "Get-PnPTerm: Value cannot be null. (Parameter 'clientObject')" error when try to get non-existent term with -Recursive mode
2 participants