Skip to content

Commit 688b19e

Browse files
committed
Handle customer creation conflict in Paddle API by checking status code
1 parent 6146bf4 commit 688b19e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/backend/base/langflow/services/paddle/subscriptions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import asyncio
66
from dataclasses import dataclass
77
from datetime import datetime
8+
from http import HTTPStatus
89
import re
910
from typing import Any, Literal
1011

@@ -88,7 +89,9 @@ async def _create_paddle_customer_and_update_clerk_metadata(
8889
)
8990
logger.info(f"Paddle customer creation response: {customer}")
9091
except Exception as exc: # noqa: BLE001
91-
customer_id = _extract_customer_id_from_error(exc)
92+
customer_id = None
93+
if hasattr(exc, 'status_code') and exc.status_code == HTTPStatus.CONFLICT:
94+
customer_id = _extract_customer_id_from_error(exc)
9295

9396
if not customer_id:
9497
if not _is_customer_already_exists_error(exc):

0 commit comments

Comments
 (0)