This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/extension / isAmbiguousFailure

isAmbiguousFailure() ​

isAmbiguousFailure(error): boolean

Failure whose outcome the app does not know, and which therefore keeps the attempt's Idempotency-Key:

  • NETWORK_ERROR, TIMEOUT or status >= 500: the operation may have happened at the gateway;
  • KEY_IN_USE (409): the previous attempt with the same key is still being processed; a new key would duplicate the operation;
  • VALIDATION_ERROR with status < 400 (a 2xx response outside the format): the operation already happened, only the response could not be read; retrying with the same key returns the same response.

Everything else (including a VALIDATION_ERROR coming from the gateway with 4xx, ABORTED and CONFIGURATION_ERROR) returns false and releases the key.

Parameters ​

error ​

unknown

Returns ​

boolean

Example ​

ts
if (isAmbiguousFailure(error)) keepKey()

Throws ​

Never throws: any value that is not an EnginexError returns false.