Skip to content

More graceful device monitor error messages #4362

Description

@maxgerhardt

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Win 10 x64

PlatformIO Version (platformio --version): 6.1.1rc1

Description of problem

When invoking pio device monitor -f <filter name> with a non-existing filter name, a long stacktrace is shown instead of a better error message.

Steps to Reproduce

  1. Execute pio device monitor -f abc in the CLI

Actual Results

>pio device monitor -f abc
Error: Traceback (most recent call last):
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\platformio\__main__.py", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\platformio\cli.py", line 71, in invoke
    return super().invoke(ctx)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\platformio\device\monitor\command.py", line 139, in device_monitor_cmd
    start_terminal(options)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\platformio\device\monitor\terminal.py", line 50, in start_terminal
    term = new_terminal(options)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\platformio\device\monitor\terminal.py", line 98, in new_terminal
    term = Terminal(
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\platformio\device\monitor\terminal.py", line 28, in __init__
    super().__init__(*args, **kwargs)
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\serial\tools\miniterm.py", line 403, in __init__
    self.update_transformations()
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\serial\tools\miniterm.py", line 454, in update_transformations
    transformations = [EOL_TRANSFORMATIONS[self.eol]] + [TRANSFORMATIONS[f]
  File "c:\users\max\appdata\local\programs\python\python38\lib\site-packages\serial\tools\miniterm.py", line 454, in <listcomp>
    transformations = [EOL_TRANSFORMATIONS[self.eol]] + [TRANSFORMATIONS[f]
KeyError: 'abc'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq/index.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

Expected Results

More gracefull error message saying "filter does not exist, please choose from: ..."

If problems with PlatformIO Build System:

-/-

Additional info

Pyserial is of the latest version.

>python -m pip install -U pyserial
Requirement already satisfied: pyserial in c:\users\max\appdata\local\programs\python\python38\lib\site-packages (3.5)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions