mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
patch manager: move try catch block to yaml.cpp
This commit is contained in:
parent
591624b96c
commit
1c7a318413
3 changed files with 43 additions and 21 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "util/yaml.hpp"
|
||||
#include "Utilities/types.h"
|
||||
|
||||
std::pair<YAML::Node, std::string> yaml_load(const std::string& from)
|
||||
{
|
||||
|
|
@ -15,3 +16,21 @@ std::pair<YAML::Node, std::string> yaml_load(const std::string& from)
|
|||
|
||||
return{result, ""};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T get_yaml_node_value(YAML::Node node, std::string& error_message)
|
||||
{
|
||||
try
|
||||
{
|
||||
return node.as<T>();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
error_message = e.what();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
template u64 get_yaml_node_value<u64>(YAML::Node, std::string&);
|
||||
template f64 get_yaml_node_value<f64>(YAML::Node, std::string&);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue