In PS7 with $ErrorView set to ConciseView a custom function in a script module does not display an error, but an error is recorded in $Error. Changing to NormalView fixes this issue. I have tested the same command in VS Code's Integrated Terminal running PS7 with ConciseView and an error is output as expected. I can't explain why this works differently based on the host.

The error itself is coming from Invoke-RestMethod which is reaching out to an Office 365 REST API. I don't see the same behavior with built in commands.
Name Value
---- -----
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
In PS7 with
$ErrorViewset toConciseViewa custom function in a script module does not display an error, but an error is recorded in$Error. Changing toNormalViewfixes this issue. I have tested the same command in VS Code's Integrated Terminal running PS7 with ConciseView and an error is output as expected. I can't explain why this works differently based on the host.The error itself is coming from
Invoke-RestMethodwhich is reaching out to an Office 365 REST API. I don't see the same behavior with built in commands.