Skip to content

Commit

Permalink
descale: Return more useful input < output wh err
Browse files Browse the repository at this point in the history
This suffers from the same issue old VS exceptions suffered from, in that it isn't clear. This should ideally be changed in the plugin itself, and once that's been done, I will remove it here.
  • Loading branch information
LightArrowsEXE committed Nov 1, 2024
1 parent a60792f commit 28622dd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions vskernels/kernels/custom.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations
from stgpytools import KwargsT, inject_self
from stgpytools import CustomValueError, KwargsT, inject_self
from inspect import Signature

from vstools import vs, core
Expand Down Expand Up @@ -62,7 +62,16 @@ def descale_function( # type: ignore[override]
if k not in Signature.from_callable(self._modify_kernel_func).parameters.keys()
}

return core.descale.Decustom(clip, width, height, kernel, int(support), *args, **clean_kwargs)
try:
return core.descale.Decustom(clip, width, height, kernel, int(support), *args, **clean_kwargs)
except vs.Error as e:
if 'Output dimension must be' in str(e):
raise CustomValueError(
f'Output dimension ({width}x{height}) must be less than or equal to '
f'input dimension ({clip.width}x{clip.height}).', self.__class__
)

raise CustomValueError(e, self.__class__)

def get_params_args(
self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
Expand Down

0 comments on commit 28622dd

Please sign in to comment.