mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
ProjectOptionValueError: displays the config option description (#4674)
ProjectOptionValueError: display the config option description It gives a bit more context of the problem for the user. Example message with the description included: `Error: Invalid value: 'invalid_debug_mode' is not one of 'always', 'modified', 'manual'. for option `debug_load_mode` (Allows one to control when PlatformIO should load debugging firmware to the end target) in section [env:nodemcu]` Co-authored-by: Ivan Kravets <me@ikravets.com>
This commit is contained in:
@ -324,6 +324,7 @@ class ProjectConfigBase:
|
||||
f"`${{this.__env__}}` is called from the `{parent_section}` "
|
||||
"section that is not valid PlatformIO environment, see",
|
||||
option,
|
||||
" ",
|
||||
section,
|
||||
)
|
||||
return parent_section[4:]
|
||||
@ -332,7 +333,10 @@ class ProjectConfigBase:
|
||||
value = self.get(section, option)
|
||||
except RecursionError as exc:
|
||||
raise exception.ProjectOptionValueError(
|
||||
"Infinite recursion has been detected", option, section
|
||||
"Infinite recursion has been detected",
|
||||
option,
|
||||
" ",
|
||||
section,
|
||||
) from exc
|
||||
if isinstance(value, list):
|
||||
return "\n".join(value)
|
||||
@ -359,7 +363,10 @@ class ProjectConfigBase:
|
||||
if not self.expand_interpolations:
|
||||
return value
|
||||
raise exception.ProjectOptionValueError(
|
||||
exc.format_message(), option, section
|
||||
exc.format_message(),
|
||||
option,
|
||||
" (%s) " % option_meta.description,
|
||||
section,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
@ -51,4 +51,4 @@ class InvalidEnvNameError(ProjectError):
|
||||
|
||||
|
||||
class ProjectOptionValueError(ProjectError):
|
||||
MESSAGE = "{0} for option `{1}` in section [{2}]"
|
||||
MESSAGE = "{0} for option `{1}`{2}in section [{3}]"
|
||||
|
Reference in New Issue
Block a user