no more ytdl-sub error usage
This commit is contained in:
parent
f4808e946b
commit
d8561365f1
2 changed files with 4 additions and 5 deletions
|
|
@ -31,7 +31,6 @@ from ytdl_sub.script.utils.exceptions import FunctionRuntimeException
|
||||||
from ytdl_sub.script.utils.exceptions import UserThrownRuntimeError
|
from ytdl_sub.script.utils.exceptions import UserThrownRuntimeError
|
||||||
from ytdl_sub.script.utils.type_checking import FunctionInputSpec
|
from ytdl_sub.script.utils.type_checking import FunctionInputSpec
|
||||||
from ytdl_sub.script.utils.type_checking import is_union
|
from ytdl_sub.script.utils.type_checking import is_union
|
||||||
from ytdl_sub.utils.exceptions import StringFormattingException
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
|
@ -56,7 +55,8 @@ class CustomFunction(Function, NamedCustomFunction):
|
||||||
|
|
||||||
if self.name in custom_functions:
|
if self.name in custom_functions:
|
||||||
if len(self.args) != len(custom_functions[self.name].function_arguments):
|
if len(self.args) != len(custom_functions[self.name].function_arguments):
|
||||||
raise StringFormattingException("Custom function arg length does not equal")
|
# Should be validated in the Script
|
||||||
|
raise UNREACHABLE
|
||||||
|
|
||||||
resolved_variables_with_args = copy.deepcopy(resolved_variables)
|
resolved_variables_with_args = copy.deepcopy(resolved_variables)
|
||||||
for i, arg in enumerate(resolved_args):
|
for i, arg in enumerate(resolved_args):
|
||||||
|
|
@ -97,7 +97,8 @@ class BuiltInFunction(Function, TypeHintedFunctionType):
|
||||||
if hasattr(Functions, self.name + "_"):
|
if hasattr(Functions, self.name + "_"):
|
||||||
return getattr(Functions, self.name + "_")
|
return getattr(Functions, self.name + "_")
|
||||||
|
|
||||||
raise StringFormattingException(f"Function name {self.name} does not exist")
|
# Should be validated in the parser
|
||||||
|
raise UNREACHABLE
|
||||||
|
|
||||||
@functools.cached_property
|
@functools.cached_property
|
||||||
def arg_spec(self) -> FullArgSpec:
|
def arg_spec(self) -> FullArgSpec:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ from ytdl_sub.script.parser import _UNEXPECTED_CHAR_ARGUMENT
|
||||||
from ytdl_sub.script.parser import BRACKET_NOT_CLOSED
|
from ytdl_sub.script.parser import BRACKET_NOT_CLOSED
|
||||||
from ytdl_sub.script.parser import ParsedArgType
|
from ytdl_sub.script.parser import ParsedArgType
|
||||||
from ytdl_sub.script.parser import parse
|
from ytdl_sub.script.parser import parse
|
||||||
from ytdl_sub.script.types.array import Array
|
|
||||||
from ytdl_sub.script.types.array import UnresolvedArray
|
from ytdl_sub.script.types.array import UnresolvedArray
|
||||||
from ytdl_sub.script.types.function import BuiltInFunction
|
from ytdl_sub.script.types.function import BuiltInFunction
|
||||||
from ytdl_sub.script.types.resolvable import Boolean
|
from ytdl_sub.script.types.resolvable import Boolean
|
||||||
|
|
@ -19,7 +18,6 @@ from ytdl_sub.script.types.resolvable import String
|
||||||
from ytdl_sub.script.types.syntax_tree import SyntaxTree
|
from ytdl_sub.script.types.syntax_tree import SyntaxTree
|
||||||
from ytdl_sub.script.types.variable import Variable
|
from ytdl_sub.script.types.variable import Variable
|
||||||
from ytdl_sub.script.utils.exceptions import InvalidSyntaxException
|
from ytdl_sub.script.utils.exceptions import InvalidSyntaxException
|
||||||
from ytdl_sub.utils.exceptions import StringFormattingException
|
|
||||||
|
|
||||||
|
|
||||||
class TestParser:
|
class TestParser:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue