Error interface

Function

  • Creates a return information object based on the Code enumeration. Error code reference
  • Creates and returns an information object based on the Code enumeration and error information msg.

Format

explicit Error(Code code = Code::OK);
explicit Error(Code code, std::string msg);

Parameters

Parameter

Mandatory/Optional

Description

Value

code

Mandatory

Error code

  • Code::OK
  • Code::ERROR
  • Code::INVALID
  • Code::NOT_FOUND

msg

Mandatory

Error message

Valid string type

Usage Example

Construct the Error object in different ways.

1
2
Error(Error::Code::OK);
Error(Error::Code::ERROR, "ERROR: Failed to get real path of home.");

Return Value

Error object.