@@ -481,17 +481,26 @@ defmodule ElixirLS.Debugger.Server do
481
481
defp handle_request ( initialize_req ( _ , client_info ) , % __MODULE__ { client_info: nil } = state ) do
482
482
# linesStartAt1 is true by default and we only support 1-based indexing
483
483
if client_info [ "linesStartAt1" ] == false do
484
- Output . debugger_important ( "0-based lines are not supported" )
484
+ raise ServerError ,
485
+ message: "invalidRequest" ,
486
+ format: "0-based lines are not supported" ,
487
+ variables: % { }
485
488
end
486
489
487
490
# columnsStartAt1 is true by default and we only support 1-based indexing
488
491
if client_info [ "columnsStartAt1" ] == false do
489
- Output . debugger_important ( "0-based columns are not supported" )
492
+ raise ServerError ,
493
+ message: "invalidRequest" ,
494
+ format: "0-based columns are not supported" ,
495
+ variables: % { }
490
496
end
491
497
492
498
# pathFormat is `path` by default and we do not support other, e.g. `uri`
493
499
if client_info [ "pathFormat" ] not in [ nil , "path" ] do
494
- Output . debugger_important ( "pathFormat #{ client_info [ "pathFormat" ] } not supported" )
500
+ raise ServerError ,
501
+ message: "invalidRequest" ,
502
+ format: "pathFormat {pathFormat} is not supported" ,
503
+ variables: % { "pathFormat" => client_info [ "pathFormat" ] }
495
504
end
496
505
497
506
{ capabilities ( ) , % { state | client_info: client_info } }
@@ -1493,10 +1502,14 @@ defmodule ElixirLS.Debugger.Server do
1493
1502
defp set_stack_trace_mode ( "all" ) , do: :int . stack_trace ( :all )
1494
1503
defp set_stack_trace_mode ( "no_tail" ) , do: :int . stack_trace ( :no_tail )
1495
1504
defp set_stack_trace_mode ( "false" ) , do: :int . stack_trace ( false )
1505
+ defp set_stack_trace_mode ( false ) , do: :int . stack_trace ( false )
1496
1506
defp set_stack_trace_mode ( nil ) , do: nil
1497
1507
1498
1508
defp set_stack_trace_mode ( _ ) do
1499
- Output . debugger_important ( ~S( stackTraceMode must be "all", "no_tail", or "false") )
1509
+ raise ServerError ,
1510
+ message: "argumentError" ,
1511
+ format: "stackTraceMode must be `all`, `no_tail`, or `false`" ,
1512
+ variables: % { }
1500
1513
end
1501
1514
1502
1515
defp capabilities do
@@ -1607,17 +1620,16 @@ defmodule ElixirLS.Debugger.Server do
1607
1620
1608
1621
defp interpret_specified_modules ( file_patterns , exclude_module_pattern ) do
1609
1622
regexes =
1610
- Enum . flat_map ( file_patterns , fn pattern ->
1623
+ Enum . map ( file_patterns , fn pattern ->
1611
1624
case Regex . compile ( pattern ) do
1612
1625
{ :ok , regex } ->
1613
- [ regex ]
1626
+ regex
1614
1627
1615
1628
{ :error , error } ->
1616
- Output . debugger_important (
1617
- "Unable to compile file pattern (#{ inspect ( pattern ) } ) into a regex. Received error: #{ inspect ( error ) } "
1618
- )
1619
-
1620
- [ ]
1629
+ raise ServerError ,
1630
+ message: "argumentError" ,
1631
+ format: "Unable to compile file pattern {pattern} into a regex: {error}" ,
1632
+ variables: % { "pattern" => inspect ( pattern ) , "error" => inspect ( error ) }
1621
1633
end
1622
1634
end )
1623
1635
0 commit comments