forked from platformio/platformio-core
Update user-related exceptions to UserSideException
This commit is contained in:
@ -16,7 +16,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from platformio import __accounts_api__, app
|
from platformio import __accounts_api__, app
|
||||||
from platformio.exception import PlatformioException
|
from platformio.exception import PlatformioException, UserSideException
|
||||||
from platformio.http import HTTPClient, HTTPClientError
|
from platformio.http import HTTPClient, HTTPClientError
|
||||||
|
|
||||||
|
|
||||||
@ -24,11 +24,11 @@ class AccountError(PlatformioException):
|
|||||||
MESSAGE = "{0}"
|
MESSAGE = "{0}"
|
||||||
|
|
||||||
|
|
||||||
class AccountNotAuthorized(AccountError):
|
class AccountNotAuthorized(AccountError, UserSideException):
|
||||||
MESSAGE = "You are not authorized! Please log in to PlatformIO Account."
|
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."
|
MESSAGE = "You are already authorized with {0} account."
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from platformio import util
|
from platformio import util
|
||||||
from platformio.exception import PlatformioException, UserSideException
|
from platformio.exception import UserSideException
|
||||||
|
|
||||||
|
|
||||||
class PackageException(PlatformioException):
|
class PackageException(UserSideException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -51,14 +51,14 @@ class MissingPackageManifestError(ManifestException):
|
|||||||
MESSAGE = "Could not find one of '{0}' manifest files in the package"
|
MESSAGE = "Could not find one of '{0}' manifest files in the package"
|
||||||
|
|
||||||
|
|
||||||
class UnknownPackageError(UserSideException):
|
class UnknownPackageError(PackageException):
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Could not find the package with '{0}' requirements for your system '%s'"
|
"Could not find the package with '{0}' requirements for your system '%s'"
|
||||||
% util.get_systype()
|
% util.get_systype()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class NotGlobalLibDir(UserSideException):
|
class NotGlobalLibDir(PackageException):
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"The `{0}` is not a PlatformIO project.\n\n"
|
"The `{0}` is not a PlatformIO project.\n\n"
|
||||||
"To manage libraries in global storage `{1}`,\n"
|
"To manage libraries in global storage `{1}`,\n"
|
||||||
|
@ -18,7 +18,7 @@ import subprocess
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from platformio import proc
|
from platformio import proc
|
||||||
from platformio.package.exception import PlatformioException, UserSideException
|
from platformio.exception import UserSideException
|
||||||
|
|
||||||
|
|
||||||
class VCSBaseException(UserSideException):
|
class VCSBaseException(UserSideException):
|
||||||
@ -70,7 +70,7 @@ class VCSClientBase:
|
|||||||
self.get_cmd_output(["--version"])
|
self.get_cmd_output(["--version"])
|
||||||
else:
|
else:
|
||||||
assert self.run_cmd(["--version"])
|
assert self.run_cmd(["--version"])
|
||||||
except (AssertionError, OSError, PlatformioException) as exc:
|
except (AssertionError, OSError) as exc:
|
||||||
raise VCSBaseException(
|
raise VCSBaseException(
|
||||||
"VCS: `%s` client is not installed in your system" % self.command
|
"VCS: `%s` client is not installed in your system" % self.command
|
||||||
) from exc
|
) from exc
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from platformio.exception import PlatformioException
|
from platformio.exception import UserSideException
|
||||||
|
|
||||||
|
|
||||||
class PlatformException(PlatformioException):
|
class PlatformException(UserSideException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ def _load_build_metadata(project_dir, env_names, debug=False):
|
|||||||
):
|
):
|
||||||
raise result.exception
|
raise result.exception
|
||||||
if '"includes":' not in result.output:
|
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)
|
return _get_cached_build_metadata(project_dir, env_names)
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import hashlib
|
|||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
@ -271,6 +272,7 @@ def log_exception(exc):
|
|||||||
"name": exc.__class__.__name__,
|
"name": exc.__class__.__name__,
|
||||||
"description": str(exc),
|
"description": str(exc),
|
||||||
"traceback": trace,
|
"traceback": trace,
|
||||||
|
"cmd_args": sys.argv[1:],
|
||||||
"is_fatal": is_fatal,
|
"is_fatal": is_fatal,
|
||||||
}
|
}
|
||||||
log_event("exception", params)
|
log_event("exception", params)
|
||||||
|
Reference in New Issue
Block a user