OpenAssetIO icon indicating copy to clipboard operation
OpenAssetIO copied to clipboard

`BatchElementError` type for callback-based batch methods

Open feltech opened this issue 3 years ago • 1 comments

What

Add a BatchElementError class to be used in error callbacks for batch-first API methods.

Why

Our batch-first design means that errors that affect only a single element of the batch should not cause the whole batch to fail. Instead, such errors are communicated via an error callback, with a unique call per failed batch element.

We need some way for the manager to communicate the reason for a failure to the error callback. In order for this to be extensible we need to bundle the error details into a class. At minimum these details will include an error code and message, giving the same level of information as a standard exception.

ACs

  • A header containing error codes in the core library that is importable in the C library, in order to prevent duplication of error codes.
    • This should not have a dependency on the C library/headers.
    • Initially supporting only "kUnknown".
    • Do not overlap these new error codes with the exception error codes.
  • BatchElementError value semantic struct containing
    • enum class ErrorCode (initially) supporting only "kUnknown".
    • Error code value, const ErrorCode code.
    • Error message value const std::string message.
  • C API sketch

Out of scope

  • New error codes.

feltech avatar Aug 08 '22 09:08 feltech

Added C API issue with sketch in #570

feltech avatar Aug 12 '22 10:08 feltech