Skip to main content

Usage

try {
  await client.publish("order/created", ["partner-id"], payload);
} catch (error) {
  if (error instanceof EnSyncError) {
    console.error("EnSync Error:", error.message);
    
    if (error.name === "EnSyncConnectionError") {
      // Retry connection
    } else if (error.name === "EnSyncPublishError") {
      // Log and alert
    }
  }
}

Error Types

Error TypeDescription
EnSyncConnectionErrorConnection or authentication issues
EnSyncPublishErrorProblems publishing events
EnSyncSubscriptionErrorSubscription-related errors
EnSyncGenericErrorOther errors