libtmux.options.handle_option_error
Python
- Python
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust Unavailable
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- libtmux.options
- Package
- libtmux
- Source
- src/libtmux/options.py
- handle_option_error ( error : str ) type[exc.OptionError]
-
Raise exception if error in option command found.
In tmux 3.0, show-option and show-window-option return invalid option instead of unknown option. See https://github.com/tmux/tmux/blob/3.0/cmd-show-options.c.
In tmux >2.4, there are 3 different types of option errors:
- unknown option
- invalid option
- ambiguous option
In tmux <2.4, unknown option was the only option.
All errors raised will have the base error of
exc.OptionError. So to catch any option error, useexcept exc.OptionError.Examples
>>> result = server.cmd(... 'set-option',... 'unknown-option-name',... )>>> bool(isinstance(result.stderr, list) and len(result.stderr))True>>> import pytest>>> from libtmux import exc>>> with pytest.raises(exc.OptionError):... handle_option_error(result.stderr[0])- Parameters
-
-
error ( str ) – Error response from subprocess call.
-
- Raises
0 declared, 0 inherited