Update user-related exceptions to UserSideException

This commit is contained in:
Ivan Kravets
2023-06-19 11:40:40 +03:00
parent e48dfbaadc
commit 292dc3fd71
6 changed files with 14 additions and 12 deletions

View File

@ -16,7 +16,7 @@ import os
import time
from platformio import __accounts_api__, app
from platformio.exception import PlatformioException
from platformio.exception import PlatformioException, UserSideException
from platformio.http import HTTPClient, HTTPClientError
@ -24,11 +24,11 @@ class AccountError(PlatformioException):
MESSAGE = "{0}"
class AccountNotAuthorized(AccountError):
class AccountNotAuthorized(AccountError, UserSideException):
MESSAGE = "You are not authorized! Please log in to PlatformIO Account."
class AccountAlreadyAuthorized(AccountError):
class AccountAlreadyAuthorized(AccountError, UserSideException):
MESSAGE = "You are already authorized with {0} account."

View File

@ -13,10 +13,10 @@
# limitations under the License.
from platformio import util
from platformio.exception import PlatformioException, UserSideException
from platformio.exception import UserSideException
class PackageException(PlatformioException):
class PackageException(UserSideException):
pass
@ -51,14 +51,14 @@ class MissingPackageManifestError(ManifestException):
MESSAGE = "Could not find one of '{0}' manifest files in the package"
class UnknownPackageError(UserSideException):
class UnknownPackageError(PackageException):
MESSAGE = (
"Could not find the package with '{0}' requirements for your system '%s'"
% util.get_systype()
)
class NotGlobalLibDir(UserSideException):
class NotGlobalLibDir(PackageException):
MESSAGE = (
"The `{0}` is not a PlatformIO project.\n\n"
"To manage libraries in global storage `{1}`,\n"

View File

@ -18,7 +18,7 @@ import subprocess
from urllib.parse import urlparse
from platformio import proc
from platformio.package.exception import PlatformioException, UserSideException
from platformio.exception import UserSideException
class VCSBaseException(UserSideException):
@ -70,7 +70,7 @@ class VCSClientBase:
self.get_cmd_output(["--version"])
else:
assert self.run_cmd(["--version"])
except (AssertionError, OSError, PlatformioException) as exc:
except (AssertionError, OSError) as exc:
raise VCSBaseException(
"VCS: `%s` client is not installed in your system" % self.command
) from exc

View File

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from platformio.exception import PlatformioException
from platformio.exception import UserSideException
class PlatformException(PlatformioException):
class PlatformException(UserSideException):
pass

View File

@ -180,7 +180,7 @@ def _load_build_metadata(project_dir, env_names, debug=False):
):
raise result.exception
if '"includes":' not in result.output:
raise exception.PlatformioException(result.output)
raise exception.UserSideException(result.output)
return _get_cached_build_metadata(project_dir, env_names)

View File

@ -17,6 +17,7 @@ import hashlib
import os
import queue
import re
import sys
import threading
import time
import traceback
@ -271,6 +272,7 @@ def log_exception(exc):
"name": exc.__class__.__name__,
"description": str(exc),
"traceback": trace,
"cmd_args": sys.argv[1:],
"is_fatal": is_fatal,
}
log_event("exception", params)