fix: handle A018 error code in admin_users sync endpoints (2 more locations)

This commit is contained in:
Fringg
2026-04-29 06:52:04 +03:00
parent c619dbcae2
commit 59080f7392
+8 -2
View File
@@ -391,7 +391,10 @@ async def _sync_subscription_to_panel(
changes['action'] = 'updated' changes['action'] = 'updated'
logger.info('Updated user in Remnawave panel', user_id=user.id) logger.info('Updated user in Remnawave panel', user_id=user.id)
except Exception as update_error: except Exception as update_error:
if hasattr(update_error, 'status_code') and update_error.status_code == 404: error_code = (getattr(update_error, 'response_data', None) or {}).get('errorCode', '')
if (
hasattr(update_error, 'status_code') and update_error.status_code == 404
) or error_code == 'A018':
panel_uuid = None # Will create new panel_uuid = None # Will create new
else: else:
raise raise
@@ -3406,7 +3409,10 @@ async def sync_user_to_panel(
await api.update_user(**update_kwargs) await api.update_user(**update_kwargs)
action = 'updated' action = 'updated'
except Exception as update_error: except Exception as update_error:
if hasattr(update_error, 'status_code') and update_error.status_code == 404: error_code = (getattr(update_error, 'response_data', None) or {}).get('errorCode', '')
if (
hasattr(update_error, 'status_code') and update_error.status_code == 404
) or error_code == 'A018':
# User not found in panel, create new # User not found in panel, create new
panel_uuid = None panel_uuid = None
else: else: