From 28622ddbdda3e39790f34171f0cbbb692940df2e Mon Sep 17 00:00:00 2001 From: LightArrowsEXE Date: Fri, 1 Nov 2024 21:46:02 +0100 Subject: [PATCH] descale: Return more useful input < output wh err 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. --- vskernels/kernels/custom.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vskernels/kernels/custom.py b/vskernels/kernels/custom.py index b8af0d2..7fafe69 100644 --- a/vskernels/kernels/custom.py +++ b/vskernels/kernels/custom.py @@ -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 @@ -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