@@ -985,23 +985,14 @@ defmodule ElixirLS.Debugger.Server do
985
985
message: "invalidRequest" ,
986
986
format: "Cannot pause process when running with no debug" ,
987
987
variables: % { } ,
988
+ send_telemetry: false ,
988
989
show_user: true
989
990
end
990
991
991
992
defp handle_request ( pause_req ( _ , thread_id ) , state = % __MODULE__ { } ) do
992
- pid = state . thread_ids_to_pids [ thread_id ]
993
+ pid = get_pid_by_thread_id! ( state , thread_id , true )
993
994
994
- if pid do
995
- :int . attach ( pid , build_attach_mfa ( :paused ) )
996
- else
997
- raise ServerError ,
998
- message: "invalidArgument" ,
999
- format: "threadId not found: {threadId}" ,
1000
- variables: % {
1001
- "threadId" => inspect ( thread_id )
1002
- } ,
1003
- show_user: true
1004
- end
995
+ :int . attach ( pid , build_attach_mfa ( :paused ) )
1005
996
1006
997
{ % { } , state }
1007
998
end
@@ -1010,7 +1001,7 @@ defmodule ElixirLS.Debugger.Server do
1010
1001
request ( _ , "stackTrace" , % { "threadId" => thread_id } = args ) ,
1011
1002
state = % __MODULE__ { }
1012
1003
) do
1013
- pid = get_pid_by_thread_id! ( state , thread_id )
1004
+ pid = get_pid_by_thread_id! ( state , thread_id , false )
1014
1005
1015
1006
case state . paused_processes [ pid ] do
1016
1007
% PausedProcess { } = paused_process ->
@@ -1050,7 +1041,8 @@ defmodule ElixirLS.Debugger.Server do
1050
1041
format: "process not paused: {threadId}" ,
1051
1042
variables: % {
1052
1043
"threadId" => inspect ( thread_id )
1053
- }
1044
+ } ,
1045
+ send_telemetry: false
1054
1046
end
1055
1047
end
1056
1048
@@ -1211,7 +1203,7 @@ defmodule ElixirLS.Debugger.Server do
1211
1203
end
1212
1204
1213
1205
defp handle_request ( continue_req ( _ , thread_id ) = args , state = % __MODULE__ { } ) do
1214
- pid = get_pid_by_thread_id! ( state , thread_id )
1206
+ pid = get_pid_by_thread_id! ( state , thread_id , true )
1215
1207
1216
1208
state =
1217
1209
case state . dbg_session do
@@ -1235,7 +1227,7 @@ defmodule ElixirLS.Debugger.Server do
1235
1227
end
1236
1228
1237
1229
defp handle_request ( next_req ( _ , thread_id ) = args , state = % __MODULE__ { } ) do
1238
- pid = get_pid_by_thread_id! ( state , thread_id )
1230
+ pid = get_pid_by_thread_id! ( state , thread_id , true )
1239
1231
1240
1232
state =
1241
1233
if match? ( { ^ pid , _ref } , state . dbg_session ) do
@@ -1255,7 +1247,7 @@ defmodule ElixirLS.Debugger.Server do
1255
1247
end
1256
1248
1257
1249
defp handle_request ( step_in_req ( _ , thread_id ) = args , state = % __MODULE__ { } ) do
1258
- pid = get_pid_by_thread_id! ( state , thread_id )
1250
+ pid = get_pid_by_thread_id! ( state , thread_id , true )
1259
1251
1260
1252
validate_dbg_pid! ( state , pid , "stepIn" )
1261
1253
@@ -1270,7 +1262,7 @@ defmodule ElixirLS.Debugger.Server do
1270
1262
end
1271
1263
1272
1264
defp handle_request ( step_out_req ( _ , thread_id ) = args , state = % __MODULE__ { } ) do
1273
- pid = get_pid_by_thread_id! ( state , thread_id )
1265
+ pid = get_pid_by_thread_id! ( state , thread_id , true )
1274
1266
1275
1267
validate_dbg_pid! ( state , pid , "stepOut" )
1276
1268
@@ -1378,15 +1370,17 @@ defmodule ElixirLS.Debugger.Server do
1378
1370
:ok
1379
1371
end
1380
1372
1381
- defp get_pid_by_thread_id! ( state = % __MODULE__ { } , thread_id ) do
1373
+ defp get_pid_by_thread_id! ( state = % __MODULE__ { } , thread_id , show_message_on_error? ) do
1382
1374
case state . thread_ids_to_pids [ thread_id ] do
1383
1375
nil ->
1384
1376
raise ServerError ,
1385
1377
message: "invalidArgument" ,
1386
- format: "threadId not found: {threadId}" ,
1378
+ format: "Unable to find process pid for DAP threadId {threadId}" ,
1387
1379
variables: % {
1388
1380
"threadId" => inspect ( thread_id )
1389
- }
1381
+ } ,
1382
+ send_telemetry: false ,
1383
+ show_user: show_message_on_error?
1390
1384
1391
1385
pid ->
1392
1386
pid
@@ -1430,7 +1424,7 @@ defmodule ElixirLS.Debugger.Server do
1430
1424
{ :error , :not_paused } ->
1431
1425
raise ServerError ,
1432
1426
message: "runtimeError" ,
1433
- format: "pid no longer paused: {pid}" ,
1427
+ format: "process with pid {pid} is not paused " ,
1434
1428
variables: % {
1435
1429
"pid" => inspect ( pid )
1436
1430
} ,
@@ -1638,7 +1632,7 @@ defmodule ElixirLS.Debugger.Server do
1638
1632
raise ServerError ,
1639
1633
message: "argumentError" ,
1640
1634
format:
1641
- "invalid `projectDir` in launch config. Expected string or nil, got #{ inspect ( project_dir ) } " ,
1635
+ "Invalid `projectDir` in launch config. Expected string or nil, got #{ inspect ( project_dir ) } " ,
1642
1636
variables: % { } ,
1643
1637
send_telemetry: false ,
1644
1638
show_user: true
@@ -1662,7 +1656,7 @@ defmodule ElixirLS.Debugger.Server do
1662
1656
raise ServerError ,
1663
1657
message: "argumentError" ,
1664
1658
format:
1665
- "invalid `taskArgs` in launch config. Expected string or nil, got #{ inspect ( task ) } " ,
1659
+ "Invalid `taskArgs` in launch config. Expected string or nil, got #{ inspect ( task ) } " ,
1666
1660
variables: % { } ,
1667
1661
send_telemetry: false ,
1668
1662
show_user: true
@@ -1674,7 +1668,7 @@ defmodule ElixirLS.Debugger.Server do
1674
1668
raise ServerError ,
1675
1669
message: "argumentError" ,
1676
1670
format:
1677
- "invalid `taskArgs` in launch config. Expected list of strings or nil, got #{ inspect ( task_args ) } " ,
1671
+ "Invalid `taskArgs` in launch config. Expected list of strings or nil, got #{ inspect ( task_args ) } " ,
1678
1672
variables: % { } ,
1679
1673
send_telemetry: false ,
1680
1674
show_user: true
@@ -1765,7 +1759,7 @@ defmodule ElixirLS.Debugger.Server do
1765
1759
raise ServerError ,
1766
1760
message: "argumentError" ,
1767
1761
format:
1768
- "invalid `excludeModules` in launch config. Expected list of strings or nil, got #{ inspect ( exclude_module_names ) } " ,
1762
+ "Invalid `excludeModules` in launch config. Expected list of strings or nil, got #{ inspect ( exclude_module_names ) } " ,
1769
1763
variables: % { } ,
1770
1764
send_telemetry: false ,
1771
1765
show_user: true
@@ -1788,7 +1782,7 @@ defmodule ElixirLS.Debugger.Server do
1788
1782
raise ServerError ,
1789
1783
message: "argumentError" ,
1790
1784
format:
1791
- "invalid `requireFiles` in launch config. Expected list of strings or nil, got #{ inspect ( required_files ) } " ,
1785
+ "Invalid `requireFiles` in launch config. Expected list of strings or nil, got #{ inspect ( required_files ) } " ,
1792
1786
variables: % { } ,
1793
1787
send_telemetry: false ,
1794
1788
show_user: true
@@ -1803,7 +1797,7 @@ defmodule ElixirLS.Debugger.Server do
1803
1797
raise ServerError ,
1804
1798
message: "argumentError" ,
1805
1799
format:
1806
- "invalid `debugInterpretModulesPatterns` in launch config. Expected list of strings or nil, got #{ inspect ( interpret_modules_patterns ) } " ,
1800
+ "Invalid `debugInterpretModulesPatterns` in launch config. Expected list of strings or nil, got #{ inspect ( interpret_modules_patterns ) } " ,
1807
1801
variables: % { } ,
1808
1802
send_telemetry: false ,
1809
1803
show_user: true
@@ -1847,7 +1841,7 @@ defmodule ElixirLS.Debugger.Server do
1847
1841
raise ServerError ,
1848
1842
message: "argumentError" ,
1849
1843
format:
1850
- "invalid `env` in launch configuration. Expected a map with string key value pairs, got #{ inspect ( env ) } " ,
1844
+ "Invalid `env` in launch configuration. Expected a map with string key value pairs, got #{ inspect ( env ) } " ,
1851
1845
variables: % { } ,
1852
1846
send_telemetry: false ,
1853
1847
show_user: true
@@ -1862,7 +1856,7 @@ defmodule ElixirLS.Debugger.Server do
1862
1856
raise ServerError ,
1863
1857
message: "argumentError" ,
1864
1858
format:
1865
- "invalid `env` in launch configuration. Expected a map with string key value pairs, got #{ inspect ( env ) } " ,
1859
+ "Invalid `env` in launch configuration. Expected a map with string key value pairs, got #{ inspect ( env ) } " ,
1866
1860
variables: % { } ,
1867
1861
send_telemetry: false ,
1868
1862
show_user: true
@@ -1878,7 +1872,7 @@ defmodule ElixirLS.Debugger.Server do
1878
1872
raise ServerError ,
1879
1873
message: "argumentError" ,
1880
1874
format:
1881
- "invalid `stackTraceMode` in launch configuration. Must be `all`, `no_tail` or `false`, got #{ inspect ( mode ) } " ,
1875
+ "Invalid `stackTraceMode` in launch configuration. Must be `all`, `no_tail` or `false`, got #{ inspect ( mode ) } " ,
1882
1876
variables: % { } ,
1883
1877
send_telemetry: false ,
1884
1878
show_user: true
0 commit comments