Skip to content

Commit

Permalink
throw gko::Error
Browse files Browse the repository at this point in the history
  • Loading branch information
yhmtsai committed Aug 17, 2023
1 parent ab80db4 commit 877eb6d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>


#include <ginkgo/core/base/exception_helpers.hpp>


namespace gko {
namespace config {

Expand All @@ -55,7 +58,7 @@ std::unique_ptr<gko::LinOpFactory> build_from_config(
config.at("Type").get_data<std::string>());
return func(config, context, exec, td);
}
return nullptr;
GKO_INVALID_STATE("Should contain Type property");
}


Expand Down
3 changes: 2 additions & 1 deletion core/config/dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>


#include <ginkgo/core/base/exception_helpers.hpp>
#include <ginkgo/core/config/config.hpp>
#include <ginkgo/core/config/registry.hpp>
#include <ginkgo/core/synthesizer/containers.hpp>
Expand Down Expand Up @@ -75,7 +76,7 @@ std::unique_ptr<ReturnType> dispatch(std::string str, const pnode& config,
const type_descriptor& td,
syn::type_list<>, List... list)
{
throw std::runtime_error("Not Found");
GKO_INVALID_STATE("Can not figure out the actual type");
}

/**
Expand Down
3 changes: 3 additions & 0 deletions core/config/stop_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************<GINKGO LICENSE>*******************************/

#include <ginkgo/core/base/exception_helpers.hpp>
#include <ginkgo/core/config/config.hpp>
#include <ginkgo/core/config/registry.hpp>
#include <ginkgo/core/stop/criterion.hpp>
Expand All @@ -41,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "core/config/config.hpp"
#include "core/config/dispatch.hpp"


namespace gko {
namespace config {

Expand Down Expand Up @@ -74,6 +76,7 @@ stop::mode get_mode(const std::string& str)
} else if (str == "rhs_norm") {
return stop::mode::rhs_norm;
}
GKO_INVALID_STATE("Not valid " + str);
}


Expand Down
1 change: 1 addition & 0 deletions include/ginkgo/core/config/registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


#include <complex>
#include <functional>
#include <map>
#include <string>
#include <unordered_map>
Expand Down

0 comments on commit 877eb6d

Please sign in to comment.