However, this function never returns any data. It only ever returns an error state.

OK - this situation it makes sense.. I guess I didn't understand the function itself, but had recently had issues with other UDFs that returned data when it worked and returned errors when it didn't, and it made it more complex to code around that.

Actually I am a Rocket Scientist! \:D