Reformat exceptions

This commit is contained in:
Ivan Kravets
2017-12-23 19:48:16 +02:00
parent adaa3757ac
commit fab4f00ad4
2 changed files with 44 additions and 45 deletions

View File

@ -127,13 +127,7 @@ class State(object):
try: try:
self._lockfile.acquire() self._lockfile.acquire()
except LockFailed: except LockFailed:
raise exception.PlatformioException( raise exception.HomeDirPermissionsError(dirname(self.path))
"The directory `{0}` or its parent directory is not owned by "
"the current user and PlatformIO can not store configuration "
"data. \nPlease check the permissions and owner of that "
"directory. Otherwise, please remove manually `{0}` "
"directory and PlatformIO will create new from the current "
"user.".format(dirname(self.path)))
def _unlock_state_file(self): def _unlock_state_file(self):
if self._lockfile: if self._lockfile:

View File

@ -53,15 +53,15 @@ class IncompatiblePlatform(PlatformioException):
class PlatformNotInstalledYet(PlatformioException): class PlatformNotInstalledYet(PlatformioException):
MESSAGE = "The platform '{0}' has not been installed yet. "\ MESSAGE = ("The platform '{0}' has not been installed yet. "
"Use `platformio platform install {0}` command" "Use `platformio platform install {0}` command")
class BoardNotDefined(PlatformioException): class BoardNotDefined(PlatformioException):
MESSAGE = "You need to specify board ID using `-b` or `--board` "\ MESSAGE = (
"option. Supported boards list is available via "\ "You need to specify board ID using `-b` or `--board` option. "
"`platformio boards` command" "Supported boards list is available via `platformio boards` command")
class UnknownBoard(PlatformioException): class UnknownBoard(PlatformioException):
@ -91,16 +91,16 @@ class MissingPackageManifest(PlatformioException):
class UndefinedPackageVersion(PlatformioException): class UndefinedPackageVersion(PlatformioException):
MESSAGE = "Could not find a version that satisfies the requirement '{0}'"\ MESSAGE = ("Could not find a version that satisfies the requirement '{0}'"
" for your system '{1}'" " for your system '{1}'")
class PackageInstallError(PlatformioException): class PackageInstallError(PlatformioException):
MESSAGE = "Could not install '{0}' with version requirements '{1}' "\ MESSAGE = (
"for your system '{2}'.\n"\ "Could not install '{0}' with version requirements '{1}' for your "
"If you use Antivirus, it can block PlatformIO Package "\ "system '{2}'.\n If you use Antivirus, it can block PlatformIO "
"Manager. Try to disable it for a while." "Package Manager. Try to disable it for a while.")
class FDUnrecognizedStatusCode(PlatformioException): class FDUnrecognizedStatusCode(PlatformioException):
@ -110,21 +110,22 @@ class FDUnrecognizedStatusCode(PlatformioException):
class FDSizeMismatch(PlatformioException): class FDSizeMismatch(PlatformioException):
MESSAGE = "The size ({0:d} bytes) of downloaded file '{1}' "\ MESSAGE = ("The size ({0:d} bytes) of downloaded file '{1}' "
"is not equal to remote size ({2:d} bytes)" "is not equal to remote size ({2:d} bytes)")
class FDSHASumMismatch(PlatformioException): class FDSHASumMismatch(PlatformioException):
MESSAGE = "The 'sha1' sum '{0}' of downloaded file '{1}' "\ MESSAGE = ("The 'sha1' sum '{0}' of downloaded file '{1}' "
"is not equal to remote '{2}'" "is not equal to remote '{2}'")
class NotPlatformIOProject(PlatformioException): class NotPlatformIOProject(PlatformioException):
MESSAGE = "Not a PlatformIO project. `platformio.ini` file has not been "\ MESSAGE = (
"found in current working directory ({0}). To initialize new project "\ "Not a PlatformIO project. `platformio.ini` file has not been "
"please use `platformio init` command" "found in current working directory ({0}). To initialize new project "
"please use `platformio init` command")
class UndefinedEnvPlatform(PlatformioException): class UndefinedEnvPlatform(PlatformioException):
@ -164,26 +165,27 @@ class APIRequestError(PlatformioException):
class InternetIsOffline(PlatformioException): class InternetIsOffline(PlatformioException):
MESSAGE = "You are not connected to the Internet.\n"\ MESSAGE = (
"If you build a project first time, we need Internet "\ "You are not connected to the Internet.\n"
"connection to install all dependencies and toolchain." "If you build a project first time, we need Internet connection "
"to install all dependencies and toolchain.")
class LibNotFound(PlatformioException): class LibNotFound(PlatformioException):
MESSAGE = "Library `{0}` has not been found in PlatformIO Registry.\n"\ MESSAGE = ("Library `{0}` has not been found in PlatformIO Registry.\n"
"You can ignore this message, if `{0}` is a built-in library "\ "You can ignore this message, if `{0}` is a built-in library "
"(included in framework, SDK). E.g., SPI, Wire, etc." "(included in framework, SDK). E.g., SPI, Wire, etc.")
class NotGlobalLibDir(PlatformioException): class NotGlobalLibDir(PlatformioException):
MESSAGE = "The `{0}` is not a PlatformIO project.\n\n"\ MESSAGE = (
"To manage libraries "\ "The `{0}` is not a PlatformIO project.\n\n"
"in global storage `{1}`,\n"\ "To manage libraries in global storage `{1}`,\n"
"please use `platformio lib --global {2}` or specify custom "\ "please use `platformio lib --global {2}` or specify custom storage "
"storage `platformio lib --storage-dir /path/to/storage/ {2}`."\ "`platformio lib --storage-dir /path/to/storage/ {2}`.\n"
"\nCheck `platformio lib --help` for details." "Check `platformio lib --help` for details.")
class InvalidLibConfURL(PlatformioException): class InvalidLibConfURL(PlatformioException):
@ -208,9 +210,9 @@ class InvalidSettingValue(PlatformioException):
class CIBuildEnvsEmpty(PlatformioException): class CIBuildEnvsEmpty(PlatformioException):
MESSAGE = "Can't find PlatformIO build environments.\n"\ MESSAGE = ("Can't find PlatformIO build environments.\n"
"Please specify `--board` or path to `platformio.ini` with "\ "Please specify `--board` or path to `platformio.ini` with "
"predefined environments using `--project-conf` option" "predefined environments using `--project-conf` option")
class UpgradeError(PlatformioException): class UpgradeError(PlatformioException):
@ -225,12 +227,15 @@ class UpgradeError(PlatformioException):
class HomeDirPermissionsError(PlatformioException): class HomeDirPermissionsError(PlatformioException):
MESSAGE = "You do not have permissions to PlatformIO home directory.\n"\ MESSAGE = (
"Please remove `{0}` folder manually and avoid using "\ "The directory `{0}` or its parent directory is not owned by the "
"`sudo pio ...`." "current user and PlatformIO can not store configuration data.\n"
"Please check the permissions and owner of that directory.\n"
"Otherwise, please remove manually `{0}` directory and PlatformIO "
"will create new from the current user.")
class CygwinEnvDetected(PlatformioException): class CygwinEnvDetected(PlatformioException):
MESSAGE = "PlatformIO does not work within Cygwin environment. "\ MESSAGE = ("PlatformIO does not work within Cygwin environment. "
"Use native Terminal instead." "Use native Terminal instead.")