4#ifndef MAGIC_EXCEPTION_HPP
5#define MAGIC_EXCEPTION_HPP
20 using std::runtime_error::runtime_error;
30 const std::string& function,
31 const std::string& error_message
35 ? function +
" failed."
36 : function +
" failed with " + error_message +
"."
191 const std::string& error_message,
192 const std::string& database_file_path
195 std::format(
"magic_load_database_file({})", database_file_path),
231 const std::string& error_message,
232 const std::string& file_path
235 std::format(
"magic_identify_file({})", file_path),
256 const std::string& error_message,
257 const std::string& flag_names
260 std::format(
"magic_set_flags({})", flag_names),
282 const std::string& error_message,
283 const std::string& parameter_name,
287 std::format(
"magic_set_parameter({}, {})", parameter_name, value),
Exception thrown when a path is empty.
Definition magic_exception.hpp:61
empty_path()
Construct empty_path.
Definition magic_exception.hpp:66
Exception thrown when the underlying std::filesystem OS API fails.
Definition magic_exception.hpp:131
filesystem_error(const std::string &path, const std::string &error_message)
Construct filesystem_error with a path and an error message.
Definition magic_exception.hpp:139
Exception thrown when magic database is not loaded.
Definition magic_exception.hpp:206
magic_database_not_loaded()
Construct magic_database_not_loaded.
Definition magic_exception.hpp:211
The base class for all exceptions thrown by the magic class.
Definition magic_exception.hpp:18
magic_exception(const std::string &function, const std::string &error_message)
Construct magic_exception with an error message and the name of the funtion where the error occurred.
Definition magic_exception.hpp:29
Exception thrown when magic::identify_file(s) fails.
Definition magic_exception.hpp:221
magic_identify_file_error(const std::string &error_message, const std::string &file_path)
Construct magic_identify_file_error with an error message, and the path of the file.
Definition magic_exception.hpp:230
Exception thrown when magic is closed.
Definition magic_exception.hpp:149
magic_is_closed()
Construct magic_is_closed.
Definition magic_exception.hpp:154
Exception thrown when magic::load_database_file fails.
Definition magic_exception.hpp:181
magic_load_database_file_error(const std::string &error_message, const std::string &database_file_path)
Construct magic_load_database_file_error with an error message and the path of the database file.
Definition magic_exception.hpp:190
Exception thrown when magic::open fails.
Definition magic_exception.hpp:164
magic_open_error(const std::string &error_message)
Construct magic_open_error with an error message.
Definition magic_exception.hpp:171
Exception thrown when magic::set_flags fails.
Definition magic_exception.hpp:246
magic_set_flags_error(const std::string &error_message, const std::string &flag_names)
Construct magic_set_flags_error with an error message and the names of the flags.
Definition magic_exception.hpp:255
Exception thrown when magic::set_parameter(s) fails.
Definition magic_exception.hpp:271
magic_set_parameter_error(const std::string &error_message, const std::string ¶meter_name, std::size_t value)
Construct magic_set_parameter_error with an error message, the name of the parameter and its value.
Definition magic_exception.hpp:281
Exception thrown when a shared progress_tracker is null.
Definition magic_exception.hpp:46
null_tracker()
Construct null_tracker.
Definition magic_exception.hpp:51
Exception thrown when a path does not exist.
Definition magic_exception.hpp:114
path_does_not_exist(const std::string &path)
Construct path_does_not_exist with the path that does not exist.
Definition magic_exception.hpp:121
Exception thrown from magic::identify_files(directory) when the path is not a directory.
Definition magic_exception.hpp:96
path_is_not_directory(const std::string &path)
Construct path_is_not_directory with the path that is not a directory.
Definition magic_exception.hpp:104
Exception thrown from magic::load_database_file when the database file path is not a regular file.
Definition magic_exception.hpp:77
path_is_not_regular_file(const std::string &path)
Construct path_is_not_regular_file with the database file path that is not a regular file.
Definition magic_exception.hpp:85