From b7f685ed628e54b80a2a45a776c96ee0c924b14b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 20 Dec 2021 19:27:56 +0200 Subject: [PATCH] Fix a bug with expired account session --- platformio/clients/account.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platformio/clients/account.py b/platformio/clients/account.py index c7c2c6fa..69c860f8 100644 --- a/platformio/clients/account.py +++ b/platformio/clients/account.py @@ -16,7 +16,7 @@ import os import time from platformio import __accounts_api__, app -from platformio.clients.http import HTTPClient +from platformio.clients.http import HTTPClient, HTTPClientError from platformio.exception import PlatformioException @@ -69,6 +69,12 @@ class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods kwargs["headers"] = headers return self.fetch_json_data(*args, **kwargs) + def fetch_json_data(self, *args, **kwargs): + try: + return super(AccountClient, self).fetch_json_data(*args, **kwargs) + except HTTPClientError as exc: + raise AccountError(str(HTTPClientError)) from exc + def login(self, username, password): try: self.fetch_authentication_token()