Skip to content

Commit 438b3b1

Browse files
authored
feat: improved error message for unknown predefined variables in env (#1875)
Now full message mentions the fact that this evaluation is expected for prededefined variables and the offending key is printed. Example: ``` error: Unknown predefined variable in environment variable 'PATH' of 'alr': Unknown formatting key: HOME ```
1 parent eb56534 commit 438b3b1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/alire/alire-environment-loading.adb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
with Ada.Exceptions;
2+
13
with Alire_Early_Elaboration;
24
with Alire.Formatting;
35
with Alire.GPR;
@@ -144,10 +146,11 @@ package body Alire.Environment.Loading is
144146
end case;
145147
end;
146148
exception
147-
when Formatting.Unknown_Formatting_Key =>
149+
when E : Formatting.Unknown_Formatting_Key =>
148150
Raise_Checked_Error
149-
("Unknown environment variable formatting key in var '" &
150-
Act.Name & " of '" & Origin & "'");
151+
("Unknown predefined variable in environment variable '" &
152+
Act.Name & "' of '" & Origin & "': " &
153+
Ada.Exceptions.Exception_Message (E));
151154
end;
152155
end loop;
153156

0 commit comments

Comments
 (0)