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)
|
|
|
|
|
|
|
|
|
2015-02-19 22:02:50 +02:00
|
|
|
class ReturnErrorCode(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2015-09-05 22:58:42 +03:00
|
|
|
class MinitermException(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2015-02-15 23:39:02 +02:00
|
|
|
class AbortedByUser(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Aborted by user"
|
|
|
|
|
|
|
|
|
2014-06-07 13:34:31 +03:00
|
|
|
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. "
|
2015-06-12 23:47:17 -05:00
|
|
|
"Use `platformio platforms install` command")
|
2014-06-13 20:47:02 +03:00
|
|
|
|
|
|
|
|
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'"
|
|
|
|
|
|
|
|
|
2015-03-11 18:12:58 +02:00
|
|
|
class UnknownFramework(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Unknown framework '%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):
|
|
|
|
|
2015-10-01 17:04:26 +01:00
|
|
|
MESSAGE = "Not a PlatformIO project. `platformio.ini` file has not been "\
|
|
|
|
"found in current working directory (%s). To initialize new project "\
|
|
|
|
"please 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
|
|
|
|
|
|
|
|
2014-12-04 23:17:45 +02:00
|
|
|
class ProjectEnvsNotAvailable(PlatformioException):
|
2014-06-12 21:17:45 +03:00
|
|
|
|
2015-10-03 15:38:33 +01: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):
|
|
|
|
|
2015-10-03 15:38:33 +01:00
|
|
|
MESSAGE = "Invalid environment '%s'. The name must start with 'env:'"
|
2014-07-27 22:39:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
class UnknownEnvNames(PlatformioException):
|
|
|
|
|
2015-10-03 15:38:33 +01:00
|
|
|
MESSAGE = "Unknown environment names '%s'. Valid names are '%s'"
|
2014-07-27 22:39:41 +03:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
2015-05-07 16:20:53 +01:00
|
|
|
class CIBuildEnvsEmpty(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"Can't find PlatformIO build environments.\nPlease specify `--board` "
|
|
|
|
"or path to `platformio.ini` with predefined environments using "
|
|
|
|
"`--project-conf` option"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
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. "
|
2015-09-10 17:47:19 +03:00
|
|
|
"More details in FAQ/Troubleshooting section: "
|
|
|
|
"http://docs.platformio.org/en/latest/faq.html"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class PlatformioUpgradeError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"%s \n\n"
|
|
|
|
"1. Please report this issue here: "
|
|
|
|
"https://github.com/platformio/platformio/issues \n"
|
|
|
|
"2. Try different installation/upgrading steps: "
|
2014-12-30 23:22:42 +02:00
|
|
|
"http://docs.platformio.org/en/latest/installation.html"
|
2014-12-03 14:18:22 +02:00
|
|
|
)
|
2015-09-10 20:23:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
class CygwinEnvDetected(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"PlatformIO does not work within Cygwin environment. "
|
|
|
|
"Use native Terminal instead."
|
|
|
|
)
|