Skip to main content

Error Handling

Understanding error responses and codes for proper error handling in your integration.


Error Response Structure

All API errors follow a consistent structure:

{
"id": "E001",
"code": "RESOURCE_NOT_FOUND",
"message": "Requested resource is not found",
"requestId": "req_12345",
"debugMessage": "No resource found with the given ID",
"subErrors": [
{
"fieldName": "resourceId",
"message": "Resource ID is invalid",
"debugMessage": "Resource ID 404 not found in the database"
}
]
}

Response Fields

FieldDescription
idError code identifier (e.g., E100, E200)
codeMachine-readable error code
messageHuman-readable error message
requestIdRequest identifier for troubleshooting
debugMessageAdditional debug information
subErrorsArray of field-level errors (for validation errors)

Error Codes

Brand Errors

CodeDescriptionResolution
E100Brand is temporarily disabled owing to failuresProvider failure. Wait and retry later.
E101Brand is not enabled for youContact Hubble support to enable this brand for your account.
E102Brand is not activeBrand is INACTIVE. Do not display to users. Check catalog for updated status.

Order Validation Errors

CodeDescriptionResolution
E150This denomination is not available for this brandRefresh your catalog. Only use denominations in amountRestrictions.denominations.
E151Order amount doesn't match the denomination amountEnsure amount = sum of (denomination × quantity).
E152Maximum denomination limit exceededReduce the denomination amount.
E153Maximum number of denominations exceededReduce the number of distinct denominations in denominationDetails.
E154Maximum number of vouchers per denomination exceededCheck maxVouchersPerDenomination in brand's amountRestrictions.
E155Voucher amount not within the allowed rangeFor FLEXIBLE brands, ensure amount is between minVoucherAmount and maxVoucherAmount.
E156Max voucher count per order exceededCheck maxVouchersPerOrder in brand's amountRestrictions.
E157Invalid denominations sentValidate denominations against brand's catalog before ordering.
E158Denomination is out of stockTry a different denomination or brand.
E159Only single denomination allowed per orderSome brands allow only one denomination type per order.
E160Order already exists for reference idThe referenceId has been used. Generate a new unique referenceId.

Voucher Generation Errors

CodeDescriptionResolution
E200Voucher generation failedProvider-side failure. Retry after 1–2 minutes. If persistent, contact Hubble support with X-REQUEST-ID.
E201Provider polling failedSame resolution as E200.
E202Order cancellation failed, order is already in terminal stateOrder has already completed (SUCCESS or FAILED). Cannot cancel.
E203Order cancellation failed, order can't be cancelled before cutoff timeWait for cutoff time or contact support.

Partner Errors

CodeDescriptionResolution
E300Insufficient wallet balanceTop up your wallet before retrying. Set up Wallet Low Balance webhook for alerts.
E301Wallet balance is inconsistentContact Hubble admin to resolve the discrepancy.
E302This resource is not availableThe requested resource doesn't exist or isn't accessible.
E303This feature is not availableThe feature is not enabled for your account. Contact support.

Limit Errors

CodeDescriptionResolution
E400Brand is temporarily unavailable, please try again laterRate limit exceeded. Wait and retry. Check your rate limit allocation.

HTTP Status Codes

StatusMeaningNotes
200SuccessCheck response body for order status (could still be FAILED)
400Bad RequestInvalid request body or parameters
401UnauthorizedInvalid or expired token. Re-authenticate.
403ForbiddenIP not whitelisted or access denied
404Not FoundResource doesn't exist
500Server ErrorContact Hubble support with X-REQUEST-ID
Order Status vs HTTP Status

For order placement, HTTP 200 doesn't mean success. Always check the status field in the response body. An order can return HTTP 200 with status: "FAILED".


Error Handling Best Practices

1. Log Everything

Always log:

  • X-REQUEST-ID
  • Full error response
  • Request payload (excluding sensitive data)
  • Timestamp
// Example error logging
function logError(error, requestId, endpoint) {
console.error({
timestamp: new Date().toISOString(),
requestId,
endpoint,
errorId: error.id,
errorCode: error.code,
message: error.message,
debugMessage: error.debugMessage
});
}

2. Handle Retries Properly

Error TypeRetry?Notes
E100 (Brand disabled)YesWait 5-10 minutes
E200, E201 (Generation failed)YesWait 1-2 minutes, max 3 retries
E300 (Insufficient balance)NoTop up wallet first
E150-E159 (Validation)NoFix request data first
E160 (Duplicate referenceId)NoGenerate new referenceId

3. User-Friendly Messages

Don't expose raw error messages to end users. Map error codes to friendly messages:

const userMessages = {
'E100': 'This brand is temporarily unavailable. Please try again later.',
'E102': 'This brand is currently not available.',
'E150': 'The selected amount is not available for this brand.',
'E200': 'Unable to generate your gift card. Please try again.',
'E300': 'Service temporarily unavailable. Please contact support.',
};

4. Implement Circuit Breakers

For repeated failures on the same brand or endpoint, implement circuit breaker patterns to prevent cascading failures.


Troubleshooting with Support

When contacting Hubble support, provide:

  1. X-REQUEST-ID — Critical for locating the request
  2. Error code and message — The full error response
  3. Timestamp — When the error occurred
  4. Order ID or Reference ID — If applicable
  5. Request payload — Excluding sensitive credentials
tip

The X-REQUEST-ID dramatically speeds up support resolution. Always generate, log, and retain it for every API call.