Skip to content

Commit

Permalink
Merge branch 'topic/better_exceptions' into 'master'
Browse files Browse the repository at this point in the history
Fix exception + better logging

Closes #1390 and #1392

See merge request eng/ide/ada_language_server!1628
  • Loading branch information
AnthonyLeonardoGracio committed Jul 18, 2024
2 parents 3e4b471 + 6ec9cf5 commit 1d1201c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
22 changes: 17 additions & 5 deletions source/ada/lsp-ada_document_symbol.adb
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,23 @@ package body LSP.Ada_Document_Symbol is

when Libadalang.Common.Ada_Pragma_Node =>
if Self.Stack.Length < 3 then
Append_Name
(Node.As_Pragma_Node.F_Id,
Kind => LSP.Enumerations.Property,
Detail => VSS.Strings.To_Virtual_String
("(" & Node.As_Pragma_Node.F_Args.Text & ")"));
declare
Pragma_Node : constant Libadalang.Analysis.Pragma_Node :=
Node.As_Pragma_Node;
begin
if not
(Pragma_Node.F_Id.Is_Null
and then Pragma_Node.F_Args.Is_Null)
then
Append_Name
(Node.As_Pragma_Node.F_Id,
Kind => LSP.Enumerations.Property,
Detail =>
VSS.Strings.To_Virtual_String
("("
& Node.As_Pragma_Node.F_Args.Text & ")"));
end if;
end;
end if;

when others =>
Expand Down
4 changes: 1 addition & 3 deletions source/ada/lsp-ada_handlers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -3260,9 +3260,7 @@ package body LSP.Ada_Handlers is
declare
Message : constant VSS.Strings.Virtual_String :=
VSS.Strings.Conversions.To_Virtual_String
("Exception: " &
Ada.Exceptions.Exception_Name (E) & " (" &
Ada.Exceptions.Exception_Message (E) & ")");
("Exception: " & Ada.Exceptions.Exception_Information (E));

begin
Self.Tracer.Trace_Exception (E, "On_Server_Request");
Expand Down
3 changes: 1 addition & 2 deletions source/ada/lsp-gnatcoll_tracers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ package body LSP.GNATCOLL_Tracers is
(if Message.Is_Empty then "Exception:" else Message);

Self.Trace
(Ada.Exceptions.Exception_Name (Error) & " - " &
Ada.Exceptions.Exception_Message (Error));
(Ada.Exceptions.Exception_Information (Error));

Self.Trace (GNAT.Traceback.Symbolic.Symbolic_Traceback (Error));
end Trace_Exception;
Expand Down
3 changes: 1 addition & 2 deletions source/gpr/lsp-gpr_documents.adb
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ package body LSP.GPR_Documents is
(GPR2.Message.Create
(Level => GPR2.Message.Error,
Message => "GPR parser unexpected " &
Ada.Exceptions.Exception_Name (E) & " " &
Ada.Exceptions.Exception_Message (E),
Ada.Exceptions.Exception_Information (E),
Sloc => GPR2.Source_Reference.Create
(Filename => Self.File.Value,
Line => 1,
Expand Down
4 changes: 1 addition & 3 deletions source/gpr/lsp-gpr_handlers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,7 @@ package body LSP.GPR_Handlers is
declare
Message : constant VSS.Strings.Virtual_String :=
VSS.Strings.Conversions.To_Virtual_String
("Exception: " &
Ada.Exceptions.Exception_Name (E) & " (" &
Ada.Exceptions.Exception_Message (E) & ")");
("Exception: " & Ada.Exceptions.Exception_Information (E));

begin
Self.Tracer.Trace_Exception (E, "On_Server_Request");
Expand Down
4 changes: 1 addition & 3 deletions source/server/lsp-server_request_jobs.adb
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ package body LSP.Server_Request_Jobs is
declare
Message : constant VSS.Strings.Virtual_String :=
VSS.Strings.Conversions.To_Virtual_String
("Exception: " &
Ada.Exceptions.Exception_Name (E) & " (" &
Ada.Exceptions.Exception_Message (E) & ")");
("Exception: " & Ada.Exceptions.Exception_Information (E));

begin
Client.On_Error_Response
Expand Down

0 comments on commit 1d1201c

Please sign in to comment.