0

I'm working on a API which for the most part a wrapper around NumPy. In some cases, the wrapper method just calls a NumPy method and returns what the NumPy method returns.

I those cases, what is better practice, should the wrapper methods validate arguments and raise error or should they should pass the arguments to NumPy and let NumPy raise the exception?

2 Answers 2

1

If your API has additional requirements for input validation then it is appropriate to raise exceptions, otherwise you could just let the input be passed to NumPy and have NumPy raise the input validation exceptions.

Sign up to request clarification or add additional context in comments.

Comments

0

when called methods, Immediately check the arguments.

However, if you only use the function internally, you do not need to raise an error.

It is a bad habit to use a lot of things that cause errors.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.