Skip to content
Merged
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
19 changes: 13 additions & 6 deletions src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.IO;
using System.Linq;
using System.Management.Automation;
using System.Security;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -497,14 +498,20 @@ protected async Task HandleSetBreakpointsRequest(
scriptFile = editorSession.Workspace.GetFile(setBreakpointsParams.Source.Path);
}
}
catch (Exception e) when (e is FileNotFoundException || e is DirectoryNotFoundException)
catch (Exception e) when (
e is FileNotFoundException ||
e is DirectoryNotFoundException ||
e is IOException ||
e is NotSupportedException ||
e is PathTooLongException ||
e is SecurityException ||
e is UnauthorizedAccessException)
{
Logger.Write(
LogLevel.Warning,
$"Attempted to set breakpoints on a non-existing file: {setBreakpointsParams.Source.Path}");

string message = this.noDebug ? string.Empty : "Source does not exist, breakpoint not set.";
Logger.WriteException(
$"Failed to set breakpoint on file: {setBreakpointsParams.Source.Path}",
e);

string message = this.noDebug ? string.Empty : "Source file could not be accessed, breakpoint not set - " + e.Message;
var srcBreakpoints = setBreakpointsParams.Breakpoints
.Select(srcBkpt => Protocol.DebugAdapter.Breakpoint.Create(
srcBkpt, setBreakpointsParams.Source.Path, message, verified: this.noDebug));
Expand Down