diff --git a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs index 0b50dca3b..333d693f2 100644 --- a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs +++ b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs @@ -15,6 +15,7 @@ using System.IO; using System.Linq; using System.Management.Automation; +using System.Security; using System.Text; using System.Threading.Tasks; @@ -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));