Skip to content

Commit fc7cbc5

Browse files
committed
refactor(errors): ConfigError -> WorkspaceError
1 parent 9a03520 commit fc7cbc5

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

docs/api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ If you need an internal API stabilized please [file an issue](https://github.com
131131
## Exceptions
132132

133133
```{eval-rst}
134-
.. autoexception:: tmuxp.exc.EmptyConfigException
134+
.. autoexception:: tmuxp.exc.EmptyWorkspaceException
135135
```
136136

137137
```{eval-rst}
138-
.. autoexception:: tmuxp.exc.ConfigError
138+
.. autoexception:: tmuxp.exc.WorkspaceError
139139
```
140140

141141
```{eval-rst}

src/tmuxp/cli/load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def load_workspace(
393393
builder = WorkspaceBuilder(
394394
sconf=sconfig, plugins=load_plugins(sconfig), server=t
395395
)
396-
except exc.EmptyConfigException:
396+
except exc.EmptyWorkspaceException:
397397
tmuxp_echo("%s is empty or parsed no config data" % workspace_file)
398398
return None
399399

src/tmuxp/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ def validate_schema(workspace_dict):
2828
"""
2929
# verify session_name
3030
if "session_name" not in workspace_dict:
31-
raise exc.ConfigError('config requires "session_name"')
31+
raise exc.WorkspaceError('config requires "session_name"')
3232

3333
if "windows" not in workspace_dict:
34-
raise exc.ConfigError('config requires list of "windows"')
34+
raise exc.WorkspaceError('config requires list of "windows"')
3535

3636
for window in workspace_dict["windows"]:
3737
if "window_name" not in window:
38-
raise exc.ConfigError('config window is missing "window_name"')
38+
raise exc.WorkspaceError('config window is missing "window_name"')
3939

4040
if "plugins" in workspace_dict:
4141
if not isinstance(workspace_dict["plugins"], list):
42-
raise exc.ConfigError('"plugins" only supports list type')
42+
raise exc.WorkspaceError('"plugins" only supports list type')
4343

4444
return True
4545

src/tmuxp/exc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class TmuxpException(Exception):
1212
"""Base Exception for Tmuxp Errors."""
1313

1414

15-
class ConfigError(TmuxpException):
15+
class WorkspaceError(TmuxpException):
1616

1717
"""Error parsing tmuxp configuration dict."""
1818

1919

20-
class EmptyConfigException(ConfigError):
20+
class EmptyWorkspaceException(WorkspaceError):
2121

2222
"""Configuration is empty."""
2323

tests/test_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def test_no_session_name():
329329

330330
sconfig = ConfigReader._load(format="yaml", content=yaml_workspace)
331331

332-
with pytest.raises(exc.ConfigError) as excinfo:
332+
with pytest.raises(exc.WorkspaceError) as excinfo:
333333
config.validate_schema(sconfig)
334334
assert excinfo.matches(r'requires "session_name"')
335335

@@ -341,7 +341,7 @@ def test_no_windows():
341341

342342
sconfig = ConfigReader._load(format="yaml", content=yaml_workspace)
343343

344-
with pytest.raises(exc.ConfigError) as excinfo:
344+
with pytest.raises(exc.WorkspaceError) as excinfo:
345345
config.validate_schema(sconfig)
346346
assert excinfo.match(r'list of "windows"')
347347

@@ -363,7 +363,7 @@ def test_no_window_name():
363363

364364
sconfig = ConfigReader._load(format="yaml", content=yaml_workspace)
365365

366-
with pytest.raises(exc.ConfigError) as excinfo:
366+
with pytest.raises(exc.WorkspaceError) as excinfo:
367367
config.validate_schema(sconfig)
368368
assert excinfo.matches('missing "window_name"')
369369

@@ -425,6 +425,6 @@ def test_plugins():
425425

426426
sconfig = ConfigReader._load(format="yaml", content=yaml_workspace)
427427

428-
with pytest.raises(exc.ConfigError) as excinfo:
428+
with pytest.raises(exc.WorkspaceError) as excinfo:
429429
config.validate_schema(sconfig)
430430
assert excinfo.matches("only supports list type")

0 commit comments

Comments
 (0)