Hi all,

What are your thoughts about how many and which type of errors should be caught and handled within functions, especially roll-your-own utility functions?

For example: suppose I have a function that removes a directory and all subdirectories and files underneath it. Should that function test for path existence? OR, should it simply allow whatever exceptions to be raised if the caller fails to properly check?

The packaged modules in Python seem to do some of each, so I'm fuddled.

Thanks,
Jeff

Removing a directory, all subdirectories and files seems to be a consequential operation, and I would error prove it to the hilt.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.