aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r--libbuild2/variable.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx
index a4c3ef3..91b25bd 100644
--- a/libbuild2/variable.cxx
+++ b/libbuild2/variable.cxx
@@ -410,6 +410,24 @@ namespace build2
v.assign (move (ns), nullptr); // Assign new data.
}
+ [[noreturn]] void
+ convert_throw (const value_type* from, const value_type& to)
+ {
+ string m ("invalid ");
+ m += to.name;
+ m += " value: ";
+
+ if (from != nullptr)
+ {
+ m += "conversion from ";
+ m += from->name;
+ }
+ else
+ m += "null";
+
+ throw invalid_argument (move (m));
+ }
+
// Throw invalid_argument for an invalid simple value.
//
[[noreturn]] static void