]> git.tdb.fi Git - builder.git/commitdiff
It's okay to throw exceptions from Loader functions
authorMikko Rasa <tdb@tdb.fi>
Tue, 4 Sep 2012 20:01:55 +0000 (23:01 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 4 Sep 2012 20:01:55 +0000 (23:01 +0300)
source/component.cpp
source/sourcepackage.cpp

index 8a57b6410ee47024cec0b88704f9998707130a4b..6bfce1fb6b8682f19c775552812b26af9da1b451 100644 (file)
@@ -302,5 +302,5 @@ void Component::Loader::use(const string &n)
                        obj.uses.push_back(&*i);
                        return;
                }
-       error(format("Unknown library component '%s'", n));
+       throw invalid_argument("Component::Loader::use");
 }
index 6eaba739586881eac93f183eeb66ad49ce13c00a..5c83fd7ec18607b4e6728a6594bbb040f017d1ee 100644 (file)
@@ -235,7 +235,7 @@ void SourcePackage::Loader::if_feature(const string &cond)
        if(equals!=string::npos)
        {
                if(equals==0)
-                       error("No feature name specified");
+                       throw invalid_argument("SourcePackage::Loader::if_feature");
                bool negate = cond[equals-1]=='!';
                string name = cond.substr(0, equals-negate);
                string value = obj.config.get_option("with_"+name).value;