From 80b61231200fa29ff23b32bc57b4e2a47ee5daa4 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 24 Apr 2025 17:43:21 +0200 Subject: modules/system-info: Provide a nice warning message, if a port is not yet registered --- modules/by-name/sy/system-info/module.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/by-name/sy/system-info/module.nix b/modules/by-name/sy/system-info/module.nix index 5e2da31..8136ae5 100644 --- a/modules/by-name/sy/system-info/module.nix +++ b/modules/by-name/sy/system-info/module.nix @@ -38,9 +38,16 @@ # TODO(@bpeetz): Check which service opens these ports: <2025-01-28> "64738" = "???"; + "4190" = "???"; }; in '' - ${mode} ${builtins.toString port}: ${mappings.${builtins.toString port}} + ${mode} ${builtins.toString port}: ${ + if (builtins.hasAttr "${builtins.toString port}" mappings) + then mappings.${builtins.toString port} + else + builtins.throw + "'${builtins.toString port}' is still missing from the system info port -> name map. Maybe add it?" + } ''; # TODO(@bpeetz): This should probably also include the allowed TCP/UDP port ranges. <2025-01-28> -- cgit 1.4.1