QOpcUaErrorState Class | Qt OPC UA 6.4.1

- Qt 6.4
- Qt OPC UA
- C++ Classes
- QOpcUaErrorState
- Qt 6.4.1 Reference Documentation

# QOpcUaErrorState Class

QOpcUaErrorState allows investigation and interaction with error state from backends. More...

Header: | #include <QOpcUaErrorState>
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: | QT += opcua
Since: | QtOpcUa 5.13

- List of all members, including inherited members

## Public Types

enum class | ConnectionStep { Unknown, CertificateValidation, OpenSecureChannel, CreateSession, ActivateSession }

## Public Functions

| QOpcUaErrorState(const QOpcUaErrorState &other)
QOpcUaErrorState & | operator=(const QOpcUaErrorState &rhs)
QOpcUaErrorState::ConnectionStep | connectionStep() const
QOpcUa::UaStatusCode | errorCode() const
bool | ignoreError() const
bool | isClientSideError() const
void | setClientSideError(bool clientSideError)
void | setConnectionStep(QOpcUaErrorState::ConnectionStep step)
void | setErrorCode(QOpcUa::UaStatusCode error)
void | setIgnoreError(bool ignore = true)

## Detailed Description

There is not need to instantiate this class in your code. A client will emit an error state via QOpcUaClient::connectError in case an error has happened while establishing a connection.

The error can be caused by the backend itself or by the server rejecting the connection. If case of errors issued by the local backend, they can be ignored by calling the function setIgnoreError().

## Member Type Documentation

### enum class QOpcUaErrorState::ConnectionStep

Specifies at which step during the connection establishment the error occurred.

Constant | Value | Description
--- | --- | ---
`QOpcUaErrorState::ConnectionStep::Unknown` | `0x00` | The connection step is unknown.
`QOpcUaErrorState::ConnectionStep::CertificateValidation` | `0x1` | Error happened in the certificate validation step.
`QOpcUaErrorState::ConnectionStep::OpenSecureChannel` | `0x2` | Error happened when opening the secure channel.
`QOpcUaErrorState::ConnectionStep::CreateSession` | `0x3` | Error happened when creating the session.
`QOpcUaErrorState::ConnectionStep::ActivateSession` | `0x4` | Error happened during session acivation.

## Member Function Documentation

### QOpcUaErrorState::QOpcUaErrorState(const QOpcUaErrorState &other)

Constructs an error state from other.

### QOpcUaErrorState &QOpcUaErrorState::operator=(const QOpcUaErrorState &rhs)

Sets the values of rhs in this error state.

### QOpcUaErrorState::ConnectionStep QOpcUaErrorState::connectionStep() const

Returns the connection step in which the error occurred.

See also setConnectionStep().

### QOpcUa::UaStatusCode QOpcUaErrorState::errorCode() const

Returns the OPC UA status code of the error occurred.

See also setErrorCode().

### bool QOpcUaErrorState::ignoreError() const

Returns if this client side error should be ignored.

See also setIgnoreError().

### bool QOpcUaErrorState::isClientSideError() const

Returns if the occurred error is a client side error.

### void QOpcUaErrorState::setClientSideError(bool clientSideError)

Sets if the occurred error is a client side error to clientSideError.

See also isClientSideError().

### void QOpcUaErrorState::setConnectionStep(QOpcUaErrorState::ConnectionStep step)

Sets the connection step in which the error occurred to step.

See also connectionStep().

### void QOpcUaErrorState::setErrorCode(QOpcUa::UaStatusCode error)

Sets the OPC UA status code of the error occurred to error.

See also errorCode().

### void QOpcUaErrorState::setIgnoreError(bool ignore = true)

Sets if this client side error should be ignored to ignore.

Setting this flag does only work if the error is actually a client side error.

See also ignoreError().