If I have a following function:
def rand(int: int) -> int:
...
rand('2')
It is working because when I call a rand
function the editor showing the error. But it is still compiling the code. And I can write something like:
def rand(num: int) -> int:
if not isinstance(num, int):
raise ValueError(f"{num} is not a integer")
return 0
I want to raise a error without doing some logic in the function. Is it possible to raise a error when calling function and without checking it?