CIF: Differentiate between zero product results and execution failures in OOTB CIF Commerce Retriever APIs
In AEM as a Cloud Service (AEMaaCS), the out-of-the-box (OOTB) CIF component Commerce Retriever APIs currently return Optional.empty() for both a successful GraphQL query that yields zero products and an execution failure (such as timeouts, HTTP 429s, or transient connectivity issues).
Because both scenarios produce the exact same return value, custom implementations have no supported way to differentiate between them. This prevents us from delivering a tailored user experience, such as showing a "No products found" message versus a "Service temporarily unavailable" retry prompt.
Proposed Implementation Approaches (Flexible):
We leave the exact contract to Adobe Engineering's discretion, but viable options include:
- Exposing a separate error object or status indicator.
- Throwing a specific checked or unchecked exception on execution failure rather than swallowing it into an empty Optional.
- Providing a metadata wrapper alongside the result.