From 7fa3d0a763cc4920ca1293de61405f6ae897ecc3 Mon Sep 17 00:00:00 2001 From: schodet Date: Sun, 17 Apr 2005 01:45:49 +0000 Subject: Ajout d'une exception plus descriptive. --- 2005/i/robert/src/config/config_data.tcc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '2005') diff --git a/2005/i/robert/src/config/config_data.tcc b/2005/i/robert/src/config/config_data.tcc index 4abad34..1377b00 100644 --- a/2005/i/robert/src/config/config_data.tcc +++ b/2005/i/robert/src/config/config_data.tcc @@ -29,7 +29,10 @@ const T & ConfigData::get (const std::string &id) const { const any &a = get (id); - return any_cast (a); + const T *v = any_cast (&a); + if (!v) + throw std::runtime_error (id + ": config item with bad type"); + return *v; } /// Ajoute une valeur de configuration, fonction générique. Attention, -- cgit v1.2.3