2017-06-05 16:02:39 +03:00
|
|
|
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
2015-11-18 17:16:17 +02:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
class PlatformioException(Exception):
|
|
|
|
|
|
|
|
MESSAGE = None
|
|
|
|
|
|
|
|
def __str__(self): # pragma: no cover
|
|
|
|
if self.MESSAGE:
|
2019-05-08 21:02:23 +03:00
|
|
|
# pylint: disable=not-an-iterable
|
2015-12-14 22:44:16 +02:00
|
|
|
return self.MESSAGE.format(*self.args)
|
2019-05-08 21:02:23 +03:00
|
|
|
|
2018-12-26 20:54:29 +02:00
|
|
|
return super(PlatformioException, self).__str__()
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2015-02-19 22:02:50 +02:00
|
|
|
class ReturnErrorCode(PlatformioException):
|
2016-11-12 00:28:49 +02:00
|
|
|
|
|
|
|
MESSAGE = "{0}"
|
2015-02-19 22:02:50 +02:00
|
|
|
|
|
|
|
|
2015-09-05 22:58:42 +03:00
|
|
|
class MinitermException(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2017-07-03 13:35:39 +03:00
|
|
|
class UserSideException(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class AbortedByUser(UserSideException):
|
2015-02-15 23:39:02 +02:00
|
|
|
|
|
|
|
MESSAGE = "Aborted by user"
|
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
#
|
|
|
|
# UDEV Rules
|
|
|
|
#
|
2018-06-20 16:32:38 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class InvalidUdevRules(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class MissedUdevRules(InvalidUdevRules):
|
|
|
|
|
|
|
|
MESSAGE = (
|
2020-09-02 18:13:20 +02:00
|
|
|
"Warning! Please install `99-platformio-udev.rules`. \nMore details: "
|
|
|
|
"https://docs.platformio.org/page/faq.html#platformio-udev-rules"
|
2019-09-23 23:13:48 +03:00
|
|
|
)
|
2019-05-07 17:51:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
class OutdatedUdevRules(InvalidUdevRules):
|
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"Warning! Your `{0}` are outdated. Please update or reinstall them."
|
2020-09-02 18:13:20 +02:00
|
|
|
"\nMore details: "
|
|
|
|
"https://docs.platformio.org/page/faq.html#platformio-udev-rules"
|
2019-09-23 23:13:48 +03:00
|
|
|
)
|
2019-05-07 17:51:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Misc
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
class GetSerialPortsError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "No implementation for your platform ('{0}') available"
|
|
|
|
|
|
|
|
|
|
|
|
class GetLatestVersionError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Can not retrieve the latest PlatformIO version"
|
|
|
|
|
|
|
|
|
2020-04-27 23:42:02 +03:00
|
|
|
class InvalidSettingName(UserSideException):
|
2014-11-29 22:39:44 +02:00
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Invalid setting with the name '{0}'"
|
2014-11-29 22:39:44 +02:00
|
|
|
|
|
|
|
|
2020-04-27 23:42:02 +03:00
|
|
|
class InvalidSettingValue(UserSideException):
|
2014-11-29 22:39:44 +02:00
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Invalid value '{0}' for the setting '{1}'"
|
2014-11-29 22:55:32 +02:00
|
|
|
|
|
|
|
|
2018-04-15 06:08:29 +03:00
|
|
|
class InvalidJSONFile(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Could not load broken JSON: {0}"
|
|
|
|
|
|
|
|
|
2020-04-27 23:42:02 +03:00
|
|
|
class CIBuildEnvsEmpty(UserSideException):
|
2015-05-07 16:20:53 +01:00
|
|
|
|
2019-09-23 23:13:48 +03:00
|
|
|
MESSAGE = (
|
|
|
|
"Can't find PlatformIO build environments.\n"
|
|
|
|
"Please specify `--board` or path to `platformio.ini` with "
|
|
|
|
"predefined environments using `--project-conf` option"
|
|
|
|
)
|
2015-05-07 16:20:53 +01:00
|
|
|
|
|
|
|
|
2015-11-26 22:02:59 +02:00
|
|
|
class UpgradeError(PlatformioException):
|
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = """{0}
|
2015-09-10 17:47:19 +03:00
|
|
|
|
2015-12-07 22:44:31 +02:00
|
|
|
* Upgrade using `pip install -U platformio`
|
2015-11-26 22:02:59 +02:00
|
|
|
* Try different installation/upgrading steps:
|
2018-08-15 19:44:02 +03:00
|
|
|
https://docs.platformio.org/page/installation.html
|
2015-11-26 22:02:59 +02:00
|
|
|
"""
|
2015-09-10 20:23:37 +03:00
|
|
|
|
|
|
|
|
2019-11-28 16:15:54 +02:00
|
|
|
class HomeDirPermissionsError(UserSideException):
|
2017-12-19 15:05:41 +02:00
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = (
|
|
|
|
"The directory `{0}` or its parent directory is not owned by the "
|
|
|
|
"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 "
|
2019-09-23 23:13:48 +03:00
|
|
|
"will create new from the current user."
|
|
|
|
)
|
2017-12-19 15:05:41 +02:00
|
|
|
|
|
|
|
|
2015-09-10 20:23:37 +03:00
|
|
|
class CygwinEnvDetected(PlatformioException):
|
|
|
|
|
2019-09-23 23:13:48 +03:00
|
|
|
MESSAGE = (
|
|
|
|
"PlatformIO does not work within Cygwin environment. "
|
|
|
|
"Use native Terminal instead."
|
|
|
|
)
|
2018-02-09 21:47:59 +02:00
|
|
|
|
|
|
|
|
2020-04-27 23:42:02 +03:00
|
|
|
class TestDirNotExists(UserSideException):
|
2019-04-19 20:33:31 +03:00
|
|
|
|
2019-09-23 23:13:48 +03:00
|
|
|
MESSAGE = (
|
|
|
|
"A test folder '{0}' does not exist.\nPlease create 'test' "
|
|
|
|
"directory in project's root and put a test set.\n"
|
|
|
|
"More details about Unit "
|
2020-02-16 21:25:30 +02:00
|
|
|
"Testing: https://docs.platformio.org/page/plus/"
|
2019-09-23 23:13:48 +03:00
|
|
|
"unit-testing.html"
|
|
|
|
)
|