Skip to content

Exceptions

All exceptions raised by the module are subclasses of HanelGatewayError.

Hierarchy

HanelGatewayError
├── HanelGatewayNetworkError      — network failure after all retries
├── HanelGatewayHttpError         — non-2xx HTTP response
├── HanelGatewaySoapFaultError    — SOAP fault in the response envelope
├── HanelGatewayApplicationError  — returnValue != 0 in the application response
└── HanelGatewayValidationError   — invalid input, no HTTP call made

Catching errors

from hanel_warehouse_gateway import (
    HanelGatewayError,
    HanelGatewayNetworkError,
    HanelGatewayHttpError,
    HanelGatewaySoapFaultError,
    HanelGatewayApplicationError,
    HanelGatewayValidationError,
)

try:
    result = gateway.send_movement_order("ORD-001", positions)
except HanelGatewayValidationError as exc:
    # Input rejected before any HTTP call — check exc.field and exc.value
    print(f"Invalid field '{exc.field}': {exc.value!r}")
except HanelGatewayNetworkError:
    # All retry attempts exhausted
    ...
except HanelGatewayApplicationError as exc:
    # Warehouse returned a non-zero returnValue
    print(f"returnValue={exc.return_value}")
except HanelGatewayError as exc:
    # Catch-all for any other gateway error
    print(exc)

All exceptions expose: message, operation, detail, timestamp.

Reference

HanelGatewayError

Bases: Exception

Base exception for all module errors.

HanelGatewayNetworkError

Bases: HanelGatewayError

Network error after all retry attempts are exhausted.

HanelGatewayHttpError

Bases: HanelGatewayError

HTTP response with a non-2xx status code.

HanelGatewaySoapFaultError

Bases: HanelGatewayError

SOAP fault present in the response envelope.

HanelGatewayApplicationError

Bases: HanelGatewayError

returnValue != 0 in the application response.

HanelGatewayValidationError

Bases: HanelGatewayError

Invalid input detected before sending. No HTTP call is made.