Result Codes#

Macros#

OMNI_FAILED

Returns true if the given omni::core::Result is a failure code.

OMNI_RETURN_IF_FAILED

If the given omni::core::Result is a failure code, calls return result to exit the current function.

OMNI_SUCCEEDED

Returns true if the given omni::core::Result is not a failure code.

Typedefs#

omni::core::Result

Error code for the result of an operation.

Variables#

constexpr Result omni::core::kResultAccessDenied

Access has been denied for this operation.

constexpr Result omni::core::kResultAlreadyExists

Object already exists.

constexpr Result omni::core::kResultFail

The operation failed.

constexpr Result omni::core::kResultInsufficientBuffer

Insufficient buffer.

constexpr Result omni::core::kResultInterrupted

An operation was interrupted. An "interruption" happens in cases where the operation did not complete successfully due to an outside system (such as a timer) interrupting it. For example, a function Result wait_for(duration d) might give kResultSuccess when function returns because the duration expired and kResultInterrupted if the system is shutting down.

constexpr Result omni::core::kResultInvalidArgument

One or more of the arguments passed to a given function was invalid.

constexpr Result omni::core::kResultInvalidDataSize

Invalid data size. This arises when the correct type of data is requested, but the requester believes the data size is different from the receiver. The cause of this is typically a version mismatch.

constexpr Result omni::core::kResultInvalidDataType

Invalid data type. This is used in cases where a specific type of data is requested, but that is not the data which the receiver has.

constexpr Result omni::core::kResultInvalidIndex

Invalid index.

constexpr Result omni::core::kResultInvalidOperation

The operation was not valid for the target. For example, attempting to perform a write operation on a read-only file would result in this error.

constexpr Result omni::core::kResultInvalidState

The system is in an invalid state to perform the operation. This is distinct from kResultInvalidOperation in that it covers situations like "system is not yet started" or "file is closed.".

constexpr Result omni::core::kResultNoInterface

Interface not implemented.

constexpr Result omni::core::kResultNoMoreItems

No more items to return. This is meant for things like reader queues when they have run out of data and will never have more data. For cases where something like an async queue being temporarily empty, use kResultTryAgain .

constexpr Result omni::core::kResultNotEnoughData

Not enough data.

constexpr Result omni::core::kResultNotFound

The item was not found.

constexpr Result omni::core::kResultNotImplemented

The feature or method was not implemented. It might be at some point in the future.

constexpr Result omni::core::kResultNotSupported

The operation is not supported.

constexpr Result omni::core::kResultNullPointer

Pointer is null.

constexpr Result omni::core::kResultOperationAborted

The operation was aborted.

constexpr Result omni::core::kResultOutOfMemory

A system is out of memory. This does not necessarily mean resident memory has been exhausted (although it can), as this code can be used to special conditions such as exhausting graphics memory or running out of a specific memory pool. It can also indicate that an allocation would have been too big and failed ahead of time.

constexpr Result omni::core::kResultSuccess

Operation successful. No error occurred.

constexpr Result omni::core::kResultTimedOut

Timed out.

constexpr Result omni::core::kResultTooMuchData

Too much data.

constexpr Result omni::core::kResultTryAgain

Try the operation again. This is typically emitted in situations where an operation would require blocking, but the system is configured to be non-blocking. For example, attempting to read from a TCP socket when no data has been received would return kResultTryAgain .

constexpr Result omni::core::kResultVersionCheckFailure

Version check failure.

constexpr Result omni::core::kResultVersionParseError

Failed to parse the version.

constexpr Result omni::core::kResultWouldBlock

Would block.

Typedefs#

using omni::core::Result = std::int32_t#

Error code for the result of an operation.

The numeric encoding for values follows Microsoft’s HRESULT scheme. Many values are direct copies of those from the Windows API, such as kResultNotImplemented. Codes which are NVIDIA-provided, will have the mask 0xa4310000. This comes from setting the “customer bit” (bit at most-significant index 2) and having a “facility” (bits from index 5-15) of 0b10000110001 aka 0x431 (which is "NVDA" in Morse Code).

Variables#

constexpr Result omni::core::kResultAccessDenied = Result(0x80070005)#

Access has been denied for this operation.

  • POSIX: EACCES

  • Windows: E_ACCESSDENIED

  • Decimal Value: -2147024891

constexpr Result omni::core::kResultAlreadyExists = Result(0x80030050)#

Object already exists.

  • POSIX: EEXIST or EBUSY

  • Decimal Value: -2147286960

constexpr Result omni::core::kResultFail = Result(0x80004005)#

The operation failed.

  • Decimal Value: -2147467259

constexpr Result omni::core::kResultInsufficientBuffer = Result(0x8007007A)#

Insufficient buffer.

  • Decimal Value: -2147024774

constexpr Result omni::core::kResultInterrupted = Result(0xa4310001)#

An operation was interrupted. An “interruption” happens in cases where the operation did not complete successfully due to an outside system (such as a timer) interrupting it. For example, a function Result wait_for(duration d) might give kResultSuccess when function returns because the duration expired and kResultInterrupted if the system is shutting down.

  • POSIX: EINTR

  • Windows: WSAEINTR

  • Decimal Value: -1540292607

constexpr Result omni::core::kResultInvalidArgument = Result(0x80070057)#

One or more of the arguments passed to a given function was invalid.

  • POSIX: EINVAL

  • Windows: E_INVALIDARG

  • Decimal Value: -2147024809

constexpr Result omni::core::kResultInvalidDataSize = Result(0x8031000C)#

Invalid data size. This arises when the correct type of data is requested, but the requester believes the data size is different from the receiver. The cause of this is typically a version mismatch.

  • Decimal Value: -2144272372

constexpr Result omni::core::kResultInvalidDataType = Result(0x8031000B)#

Invalid data type. This is used in cases where a specific type of data is requested, but that is not the data which the receiver has.

  • Decimal Value: -2144272373

constexpr Result omni::core::kResultInvalidIndex = Result(0x80091008)#

Invalid index.

  • POSIX: covered by EINVAL or ENOENT, depending on the situation

  • Decimal Value: -2146889720

constexpr Result omni::core::kResultInvalidOperation = Result(0x800710DD)#

The operation was not valid for the target. For example, attempting to perform a write operation on a read-only file would result in this error.

  • POSIX: EPERM

  • Decimal Value: -2147020579

constexpr Result omni::core::kResultInvalidState = Result(0x80070004)#

The system is in an invalid state to perform the operation. This is distinct from kResultInvalidOperation in that it covers situations like “system is not yet started” or “file is closed.”.

  • Decimal Value: -2147024892

constexpr Result omni::core::kResultNoInterface = Result(0x80004002)#

Interface not implemented.

  • Decimal Value: -2147467262

constexpr Result omni::core::kResultNoMoreItems = Result(0x8009002A)#

No more items to return. This is meant for things like reader queues when they have run out of data and will never have more data. For cases where something like an async queue being temporarily empty, use kResultTryAgain.

  • Decimal Value: -2146893782

constexpr Result omni::core::kResultNotEnoughData = Result(0x80290101)#

Not enough data.

  • Decimal Value: -2144796415

constexpr Result omni::core::kResultNotFound = Result(0x80070002)#

The item was not found.

  • Decimal Value: -2147024894

constexpr Result omni::core::kResultNotImplemented = Result(0x80004001)#

The feature or method was not implemented. It might be at some point in the future.

  • POSIX: ENOSYS

  • Windows: E_NOTIMPL

  • Decimal Value: -2147467263

constexpr Result omni::core::kResultNotSupported = Result(0x80070032)#

The operation is not supported.

  • Decimal Value: -2147024846

constexpr Result omni::core::kResultNullPointer = Result(0x80004003)#

Pointer is null.

  • POSIX: covered by EINVAL

  • Decimal Value: -2147467261

constexpr Result omni::core::kResultOperationAborted = Result(0x80004004)#

The operation was aborted.

  • Windows: E_ABORT

  • Decimal Value: -2147467260

constexpr Result omni::core::kResultOutOfMemory = Result(0x8007000E)#

A system is out of memory. This does not necessarily mean resident memory has been exhausted (although it can), as this code can be used to special conditions such as exhausting graphics memory or running out of a specific memory pool. It can also indicate that an allocation would have been too big and failed ahead of time.

  • POSIX: ENOMEM

  • Windows: E_OUTOFMEMORY

  • Decimal Value: -2147024882

constexpr Result omni::core::kResultSuccess = 0#

Operation successful. No error occurred.

constexpr Result omni::core::kResultTimedOut = Result(0xa431274C)#

Timed out.

  • POSIX: ETIMEDOUT

  • Windows: WSAETIMEDOUT

  • Decimal Value: -1540282548

constexpr Result omni::core::kResultTooMuchData = Result(0x80290102)#

Too much data.

  • Decimal Value: -2144796414

constexpr Result omni::core::kResultTryAgain = Result(0x8007106B)#

Try the operation again. This is typically emitted in situations where an operation would require blocking, but the system is configured to be non-blocking. For example, attempting to read from a TCP socket when no data has been received would return kResultTryAgain.

  • POSIX: EAGAIN, EWOULDBLOCK

  • Windows: WMI_TRY_AGAIN

  • Decimal Value: -2147020693 Try the operation again.

constexpr Result omni::core::kResultVersionCheckFailure = Result(0x80070283)#

Version check failure.

  • Decimal Value: -2147024253

constexpr Result omni::core::kResultVersionParseError = Result(0x80070309)#

Failed to parse the version.

  • Decimal Value: -2147024119

constexpr Result omni::core::kResultWouldBlock = Result(0xa4312733)#

Would block.

  • POSIX: EWOULDBLOCK

  • Windows: WSAEWOULDBLOCK

  • Decimal value: -1540282573