diff --git a/packages/metals-vscode/src/extension.ts b/packages/metals-vscode/src/extension.ts index a02b32b0..9f578852 100644 --- a/packages/metals-vscode/src/extension.ts +++ b/packages/metals-vscode/src/extension.ts @@ -593,22 +593,36 @@ function launchMetals( registerCommand( ClientCommands.StartDebugSession, (param: ScalaCodeLensesParams) => { - scalaDebugger.start(false, param).then((wasStarted) => { - if (!wasStarted) { - window.showErrorMessage("Debug session not started"); + scalaDebugger.start(false, param).then( + (wasStarted) => { + if (!wasStarted) { + window.showErrorMessage("Debug session not started"); + } + }, + (reason) => { + if (reason instanceof Error) { + window.showErrorMessage(reason.message); + } } - }); + ); } ); registerCommand( ClientCommands.StartRunSession, (param: ScalaCodeLensesParams) => { - scalaDebugger.start(true, param).then((wasStarted) => { - if (!wasStarted) { - window.showErrorMessage("Run session not started"); + scalaDebugger.start(true, param).then( + (wasStarted) => { + if (!wasStarted) { + window.showErrorMessage("Run session not started"); + } + }, + (reason) => { + if (reason instanceof Error) { + window.showErrorMessage(reason.message); + } } - }); + ); } );