From 438b3b1988c255fa12a6888c9580199fe2245f06 Mon Sep 17 00:00:00 2001 From: Manuel Date: Mon, 3 Mar 2025 11:06:32 +0100 Subject: [PATCH] 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 ``` --- src/alire/alire-environment-loading.adb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/alire/alire-environment-loading.adb b/src/alire/alire-environment-loading.adb index 18ac8264..982d20dd 100644 --- a/src/alire/alire-environment-loading.adb +++ b/src/alire/alire-environment-loading.adb @@ -1,3 +1,5 @@ +with Ada.Exceptions; + with Alire_Early_Elaboration; with Alire.Formatting; with Alire.GPR; @@ -144,10 +146,11 @@ package body Alire.Environment.Loading is end case; end; exception - when Formatting.Unknown_Formatting_Key => + when E : Formatting.Unknown_Formatting_Key => Raise_Checked_Error - ("Unknown environment variable formatting key in var '" & - Act.Name & " of '" & Origin & "'"); + ("Unknown predefined variable in environment variable '" & + Act.Name & "' of '" & Origin & "': " & + Ada.Exceptions.Exception_Message (E)); end; end loop; -- 2.39.5