Currently, when a custom function provides type information for its parameters, Excel does some basic validation. For instance, if you say the parameter's type is `number` and the user provides `"x"`, the custom function isn't even called, Excel just shows the #NUM! error with a generic message.
This is often what you want, but for more complex and polished custom functions, make it possible for a function to opt out of that pre-validation and do all of its own validation.
One way to do that would be to have the function provide a validator function, perhaps as a property of the main custom function, but the exact mechanism isn't all that important.
Note: This partially ties into this request that all ErrorCode codes allow custom messages, rather than just two, but they're separate issues.