Skip to content

hotfix for #4932 to show better error message#4933

Merged
gautamdsheth merged 3 commits into
pnp:devfrom
wuxiaojun514:4932
May 24, 2025
Merged

hotfix for #4932 to show better error message#4933
gautamdsheth merged 3 commits into
pnp:devfrom
wuxiaojun514:4932

Conversation

@wuxiaojun514
Copy link
Copy Markdown
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
Copy Markdown
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