Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/PowerShell/PowerShellManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ internal Hashtable InvokeFunction(
}
catch (RuntimeException e)
{
if (e.ErrorRecord.FullyQualifiedErrorId == "CommandNotFoundException")
{
_logger.Log(isUserOnlyLog: false, LogLevel.Warning, PowerShellWorkerStrings.CommandNotFoundException_Exception);
}

Logger.Log(isUserOnlyLog: true, LogLevel.Error, GetFunctionExceptionMessage(e));
throw;
}
Expand Down
5 changes: 5 additions & 0 deletions src/PowerShell/StreamHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public void ErrorDataAdding(object sender, DataAddingEventArgs e)
{
if(e.ItemAdded is ErrorRecord record)
{
if (record.FullyQualifiedErrorId == "CommandNotFoundException")
{
_logger.Log(isUserOnlyLog: false, LogLevel.Warning, PowerShellWorkerStrings.CommandNotFoundException_Error);
}

_logger.Log(isUserOnlyLog: true, LogLevel.Error, $"ERROR: {_errorRecordFormatter.Format(record)}", record.Exception);
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/resources/PowerShellWorkerStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,10 @@
<data name="FailedToEnumerateDependencySnapshotContent" xml:space="preserve">
<value>Failed to enumerate dependency snapshot '{0}' content: {1}</value>
</data>
<data name="CommandNotFoundException_Error" xml:space="preserve">
<value>CommandNotFoundException detected (error).</value>
</data>
<data name="CommandNotFoundException_Exception" xml:space="preserve">
<value>CommandNotFoundException detected (exception).</value>
</data>
</root>