CppCommon 1.0.5.0
C++ Common Library
Loading...
Searching...
No Matches
exceptions.cpp
Go to the documentation of this file.
1
10
11namespace CppCommon {
12
13std::string FileSystemException::string() const
14{
15 if (_cache.empty())
16 {
17 std::stringstream stream;
18 stream << "File system exception: " << _message << std::endl;
19 if (!_path.empty())
20 stream << "File system path: " << _path << std::endl;
21 if (!_src.empty())
22 stream << "File system source path: " << _src << std::endl;
23 if (!_dst.empty())
24 stream << "File system destination path: " << _dst << std::endl;
25 stream << "System error: " << _system_error << std::endl;
26 stream << "System message: " << _system_message << std::endl;
27 std::string location = _location.string();
28 if (!location.empty())
29 stream << "Source location: " << location << std::endl;
30 _cache = stream.str();
31 }
32 return _cache;
33}
34
35} // namespace CppCommon
SourceLocation _location
Exception location.
Definition exceptions.h:74
std::string _message
Exception message.
Definition exceptions.h:72
std::string _cache
Cached exception string.
Definition exceptions.h:70
const SourceLocation & location() const noexcept
Get exception location.
Definition exceptions.h:51
std::string string() const override
Get string from the current exception.
Path _src
Filesystem exception source path.
Definition exceptions.h:47
Path _dst
Filesystem exception destination path.
Definition exceptions.h:49
Path _path
Filesystem exception path.
Definition exceptions.h:45
bool empty() const noexcept
Is the path empty?
Definition path.h:191
std::string string() const
Get the string from the current source location.
int _system_error
System error code.
Definition exceptions.h:148
std::string _system_message
System error message.
Definition exceptions.h:150
File system exceptions definition.
C++ Common project definitions.