Status interface

Function

  • Create a status object based on the error code. For details about the error code, see Code Enumeration.
  • Creates a status object based on the error code and msg of the string type.
  • Creates the status using the Error object. For details about the Error object, see Error.

Format

explicit Status(Error::Code code = Error::Code::OK) noexcept;
explicit Status(Error::Code code, const std::string &msg);
explicit Status(const Error &error);

Parameters

Parameter

Mandatory/Optional

Description

Value

code

Mandatory

Error code

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

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

Parameter

Mandatory/Optional

Description

Value

error

Mandatory

Error message object

Returned object of valid error information. For details about the Error class, see Error.

Usage Example

Create a Status object using any of the following methods:

1
2
3
4
5
6
7
8
Status(Error::Code::OK);

Status(Error::Code::ERROR, "Engine init model failed: new modelBackend failed");

Status CommonErrorToStatus(const Error &error)
{
    return Status(error);
}

Return Value

Status object.