2014-06-07 13:34:31 +03:00
|
|
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
|
|
|
# See LICENSE for details.
|
|
|
|
|
|
|
|
|
|
|
|
class PlatformioException(Exception):
|
|
|
|
|
|
|
|
MESSAGE = None
|
|
|
|
|
|
|
|
def __str__(self): # pragma: no cover
|
|
|
|
if self.MESSAGE:
|
|
|
|
return self.MESSAGE % self.args
|
|
|
|
else:
|
|
|
|
return Exception.__str__(self)
|
|
|
|
|
|
|
|
|
|
|
|
class UnknownPlatform(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Unknown platform '%s'"
|
|
|
|
|
|
|
|
|
2014-06-13 20:47:02 +03:00
|
|
|
class PlatformNotInstalledYet(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = ("The platform '%s' has not been installed yet. "
|
|
|
|
"Use `platformio install` command")
|
|
|
|
|
|
|
|
|
2014-06-07 13:34:31 +03:00
|
|
|
class UnknownCLICommand(PlatformioException):
|
|
|
|
|
2014-12-03 14:18:22 +02:00
|
|
|
MESSAGE = ("Unknown command '%s'. Please use `platformio --help`"
|
|
|
|
" to see all available commands")
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2014-12-29 20:22:01 +02:00
|
|
|
class UnknownBoard(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Unknown board type '%s'"
|
|
|
|
|
|
|
|
|
2014-06-07 13:34:31 +03:00
|
|
|
class UnknownPackage(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Detected unknown package '%s'"
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidPackageVersion(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "The package '%s' with version '%d' does not exist"
|
|
|
|
|
|
|
|
|
|
|
|
class NonSystemPackage(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "The package '%s' is not available for your system '%s'"
|
|
|
|
|
|
|
|
|
|
|
|
class FDUnrecognizedStatusCode(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Got an unrecognized status code '%s' when downloaded %s"
|
|
|
|
|
|
|
|
|
|
|
|
class FDSizeMismatch(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = ("The size (%d bytes) of downloaded file '%s' "
|
|
|
|
"is not equal to remote size (%d bytes)")
|
|
|
|
|
|
|
|
|
|
|
|
class FDSHASumMismatch(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = ("The 'sha1' sum '%s' of downloaded file '%s' "
|
|
|
|
"is not equal to remote '%s'")
|
|
|
|
|
|
|
|
|
|
|
|
class NotPlatformProject(PlatformioException):
|
|
|
|
|
2014-12-03 12:45:23 +02:00
|
|
|
MESSAGE = "Not a PlatformIO project (%s). Use `platformio init` command"
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
class UndefinedEnvPlatform(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Please specify platform for '%s' environment"
|
|
|
|
|
|
|
|
|
|
|
|
class UnsupportedArchiveType(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Can not unpack file '%s'"
|
2014-06-12 21:17:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
class ProjectInitialized(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = ("Project is already initialized. "
|
|
|
|
"Process it with `platformio run` command")
|
|
|
|
|
|
|
|
|
2014-12-04 23:17:45 +02:00
|
|
|
class ProjectEnvsNotAvailable(PlatformioException):
|
2014-06-12 21:17:45 +03:00
|
|
|
|
|
|
|
MESSAGE = "Please setup environments in `platformio.ini` file."
|
2014-07-27 22:29:32 +03:00
|
|
|
|
|
|
|
|
2014-07-27 22:39:41 +03:00
|
|
|
class InvalidEnvName(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Invalid environment '%s'. The name must start " "with 'env:'."
|
|
|
|
|
|
|
|
|
|
|
|
class UnknownEnvNames(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Unknown environment names '%s'."
|
|
|
|
|
|
|
|
|
2014-07-27 22:29:32 +03:00
|
|
|
class GetSerialPortsError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "No implementation for your platform ('%s') available"
|
2014-08-03 18:40:20 +03:00
|
|
|
|
|
|
|
|
|
|
|
class GetLatestVersionError(PlatformioException):
|
|
|
|
|
2015-02-13 23:55:08 +02:00
|
|
|
MESSAGE = "Can't retrieve the latest PlatformIO version"
|
2014-09-03 23:03:49 +03:00
|
|
|
|
|
|
|
|
|
|
|
class APIRequestError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "[API] %s"
|
2014-09-04 18:58:12 +03:00
|
|
|
|
|
|
|
|
|
|
|
class LibAlreadyInstalledError(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class LibNotInstalledError(PlatformioException):
|
|
|
|
|
2014-10-19 00:14:11 +03:00
|
|
|
MESSAGE = "Library #%d has not been installed yet"
|
|
|
|
|
|
|
|
|
|
|
|
class LibInstallDependencyError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Error has been occurred for library dependency '%s'"
|
2014-11-22 23:55:17 +02:00
|
|
|
|
|
|
|
|
2014-12-16 23:45:00 +02:00
|
|
|
class InvalidLibConfURL(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Invalid library config URL '%s'"
|
|
|
|
|
|
|
|
|
2014-11-22 23:55:17 +02:00
|
|
|
class BuildScriptNotFound(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Invalid path '%s' to build script"
|
2014-11-29 22:39:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidSettingName(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Invalid setting with the name '%s'"
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidSettingValue(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Invalid value '%s' for the setting '%s'"
|
2014-11-29 22:55:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
class UpgraderFailed(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "An error occurred while upgrading PlatformIO"
|
2014-12-03 14:18:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SConsNotInstalled(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = (
|
2014-12-03 20:16:50 +02:00
|
|
|
"The PlatformIO and `scons` aren't installed properly. "
|
|
|
|
"Please use official installation manual: "
|
2014-12-30 23:22:42 +02:00
|
|
|
"http://docs.platformio.org/en/latest/installation.html"
|
2014-12-03 14:18:22 +02:00
|
|
|
)
|