You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the cmdlet Update-IntuneDeviceConfigurationPolicy does not throw if an error occurs during execution. Instead, it simply logs the error to the event channel and returns null to the caller.
As a consumer of the cmdlet, I would like to know if an error happened and for me, it would be the best if the execution is stopped and the exception is thrown to the higher levels to have them handle the issue. So the updated catch clause should look like the following in my opinion:
Instead of returning null, I believe it's better if we rethrow the exception to stop the execution flow and let the caller of the cmdlet handle the exception. What do you think?
I always preferred when code fails fast and hard otherwise it might continue with unforeseen consequences, so yes I'm all for the function to throw an exception instead of returning $null.
Description of the issue
Currently, the cmdlet
Update-IntuneDeviceConfigurationPolicy
does not throw if an error occurs during execution. Instead, it simply logs the error to the event channel and returns null to the caller.It currently looks like the following:
As a consumer of the cmdlet, I would like to know if an error happened and for me, it would be the best if the execution is stopped and the exception is thrown to the higher levels to have them handle the issue. So the updated catch clause should look like the following in my opinion:
Instead of returning null, I believe it's better if we rethrow the exception to stop the execution flow and let the caller of the cmdlet handle the exception. What do you think?
For visibility: @ricmestre
Microsoft 365 DSC Version
DEV
Which workloads are affected
Intune
The DSC configuration
No response
Verbose logs showing the problem
No response
Environment Information + PowerShell Version
No response
The text was updated successfully, but these errors were encountered: