ToString
Function
Converts the returned object to the character string format. Specifically, it maps the error code to the corresponding character and combines the error code with the error message using a colon (:).
Format
std::string ToString() const;
Parameters
None
Usage Example
Construct an Error object and convert the returned object into a character string. Specifically, after the error code is mapped to the corresponding character, it is combined with the error information using a colon (:).
1 2 | auto err = Error(Error::Code::ERROR, "ERROR: Failed to get real path of home."); err.ToString(); |
Return Value
String converted from the object.
Error Object |
Returned Character Format |
|---|---|
Error::Code::OK |
OK: + msg |
Error::Code::ERROR |
Error: +msg |
Error::Code::INVALID_ARG |
Invalid argument: +msg |
Error::Code::NOT_FOUND |
Not found: +msg |
Parent topic: Error