-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revue xtd::io::file_not_found_exception code
- Loading branch information
1 parent
9c1f798
commit d65b57f
Showing
3 changed files
with
116 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "../../../include/xtd/io/file_not_found_exception.h" | ||
|
||
using namespace xtd; | ||
using namespace xtd::diagnostics; | ||
using namespace xtd::io; | ||
|
||
file_not_found_exception::file_not_found_exception(const stack_frame& stack_frame) : io_exception {stack_frame} { | ||
error_code(h_result::make_error_code(h_result::COR_E_FILENOTFOUND)); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const optional<string>& message, const stack_frame& stack_frame) : io_exception {message, stack_frame} { | ||
error_code(h_result::make_error_code(h_result::COR_E_FILENOTFOUND)); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const optional<string>& message, const xtd::optional<xtd::string>& file_name, const xtd::diagnostics::stack_frame& stack_frame) : io_exception {message, stack_frame}, file_name_{file_name} { | ||
error_code(h_result::make_error_code(h_result::COR_E_FILENOTFOUND)); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const string& message, const std::error_code& error, const stack_frame& stack_frame) : io_exception(message, stack_frame) { | ||
error_code(error); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const string& message, const std::error_code& error, const string& help_link, const stack_frame& stack_frame) : io_exception(message, stack_frame) { | ||
error_code(error); | ||
this->help_link(help_link); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const std::exception& inner_exception, const stack_frame& stack_frame) : io_exception(stack_frame) { | ||
error_code(h_result::make_error_code(h_result::COR_E_FILENOTFOUND)); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const string& message, const std::exception& inner_exception, const stack_frame& stack_frame) : io_exception(message, stack_frame) { | ||
error_code(h_result::make_error_code(h_result::COR_E_FILENOTFOUND)); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const string& message, const std::exception& inner_exception, const std::error_code& error, const stack_frame& stack_frame) : io_exception(message, stack_frame) { | ||
error_code(error); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const string& message, const std::exception& inner_exception, const string& help_link, const stack_frame& stack_frame) : io_exception(message, stack_frame) { | ||
error_code(h_result::make_error_code(h_result::COR_E_FILENOTFOUND)); | ||
this->help_link(help_link); | ||
} | ||
|
||
file_not_found_exception::file_not_found_exception(const string& message, const std::exception& inner_exception, const std::error_code& error, const string& help_link, const xtd::diagnostics::stack_frame& stack_frame) : io_exception(message, stack_frame) { | ||
error_code(error); | ||
this->help_link(help_link); | ||
} | ||
|
||
const xtd::optional<xtd::string>& file_not_found_exception::file_name() const noexcept { | ||
return file_name_; | ||
} | ||
|
||
const xtd::string& file_not_found_exception::message() const noexcept { | ||
if (!file_name_.has_value()) return exception::message(); | ||
thread_local static string message; | ||
message = string::format("Could not load file '{}'. The system cannot find the file specified.", file_name_.value()); | ||
return message; | ||
} |