Commit fcf61e2f authored by Davis King's avatar Davis King

Changed the configure_loggers_from_file() function so that it throws a

specific exception rather than dlib::error upon encountering a problem.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403745
parent 9d09a8db
...@@ -146,7 +146,7 @@ namespace dlib ...@@ -146,7 +146,7 @@ namespace dlib
ifstream fin(file_name.c_str()); ifstream fin(file_name.c_str());
if (!fin) if (!fin)
throw error("logger_config: unable to open config file " + file_name); throw logger_config_file_error("logger_config: unable to open config file " + file_name);
cr_type main_cr; cr_type main_cr;
...@@ -181,7 +181,7 @@ namespace dlib ...@@ -181,7 +181,7 @@ namespace dlib
if (one == "file" && three.size() == 0) if (one == "file" && three.size() == 0)
set_all_logging_output_streams(get_file_stream(two)); set_all_logging_output_streams(get_file_stream(two));
else else
throw error("logger_config: invalid argument to output option: " + output); throw logger_config_file_error("logger_config: invalid argument to output option: " + output);
} }
} // if (cr.is_key_defined("output")) } // if (cr.is_key_defined("output"))
......
...@@ -12,6 +12,16 @@ ...@@ -12,6 +12,16 @@
namespace dlib namespace dlib
{ {
class logger_config_file_error : public error
{
/*!
WHAT THIS OBJECT REPRESENTS
This is the exception class used by the configure_loggers_from_file()
function defined below.
!*/
public:
logger_config_file_error(const std::string& s):error(s){}
};
void configure_loggers_from_file ( void configure_loggers_from_file (
const std::string& file_name const std::string& file_name
...@@ -20,7 +30,7 @@ namespace dlib ...@@ -20,7 +30,7 @@ namespace dlib
ensures ensures
- configures the loggers with the contents of the file_name file - configures the loggers with the contents of the file_name file
throws throws
- dlib::error - dlib::logger_config_file_error
this exception is thrown if there is a problem reading the config file this exception is thrown if there is a problem reading the config file
!*/ !*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment