raise OBSWSCLIError

This commit is contained in:
onyx-and-iris 2025-07-17 04:28:59 +01:00
parent f0eb518609
commit abbab5c746

View File

@ -2,12 +2,14 @@
from typing import Annotated from typing import Annotated
from cyclopts import App, Argument, CycloptsError, Parameter from cyclopts import App, Argument, Parameter
from rich.table import Table from rich.table import Table
from rich.text import Text from rich.text import Text
from . import console, util, validate from . import console, util, validate
from .context import Context from .context import Context
from .enum import ExitCode
from .error import OBSWSCLIError
app = App(name='scene') app = App(name='scene')
@ -68,9 +70,9 @@ def current(
): ):
"""Get the current program scene or preview scene.""" """Get the current program scene or preview scene."""
if preview and not validate.studio_mode_enabled(ctx): if preview and not validate.studio_mode_enabled(ctx):
raise CycloptsError( raise OBSWSCLIError(
'Studio mode is not enabled, cannot get preview scene.', 'Studio mode is not enabled, cannot get preview scene.',
console=console.err, code=ExitCode.INVALID_PARAMETER,
) )
if preview: if preview:
@ -98,15 +100,15 @@ def switch(
): ):
"""Switch to a scene.""" """Switch to a scene."""
if preview and not validate.studio_mode_enabled(ctx): if preview and not validate.studio_mode_enabled(ctx):
raise CycloptsError( raise OBSWSCLIError(
'Studio mode is not enabled, cannot set the preview scene.', 'Studio mode is not enabled, cannot switch to preview scene.',
console=console.err, code=ExitCode.INVALID_PARAMETER,
) )
if not validate.scene_in_scenes(ctx, scene_name): if not validate.scene_in_scenes(ctx, scene_name):
raise CycloptsError( raise OBSWSCLIError(
f'Scene [yellow]{scene_name}[/yellow] not found.', f'Scene [yellow]{scene_name}[/yellow] not found.',
console=console.err, code=ExitCode.NOT_FOUND,
) )
if preview: if preview: