* [PATCH proxmox] rest-server: throw meaningful error if template file does not exist
@ 2026-06-26 9:32 Christoph Heiss
0 siblings, 0 replies; only message in thread
From: Christoph Heiss @ 2026-06-26 9:32 UTC (permalink / raw)
To: pdm-devel
Otherwise, users just fail on startup while constructing an `ApiConfig`
instance, with this pretty unhelpful error message:
Error: No such file or directory (os error 2)
Give some context to make it easier to trace down these errors in the
future.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Noticed this while building the latest master of
proxmox-datacenter-manager, which requires a new template as of
60a1c406 ("server: add and serve template for novnc")
.. but the corresponding package hasn't been bumped yet.
proxmox-rest-server/src/api_config.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/proxmox-rest-server/src/api_config.rs b/proxmox-rest-server/src/api_config.rs
index 6c5c0aea..2f590018 100644
--- a/proxmox-rest-server/src/api_config.rs
+++ b/proxmox-rest-server/src/api_config.rs
@@ -421,6 +421,10 @@ mod templates {
}
let path: PathBuf = path.into();
+ if !path.exists() {
+ bail!("template file not found: {}", path.display());
+ }
+
let metadata = metadata(&path)?;
let mtime = metadata.modified()?;
--
2.54.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-26 9:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 9:32 [PATCH proxmox] rest-server: throw meaningful error if template file does not exist Christoph Heiss
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.