I built a library/module for a bigger application which throws an Exception from a function. The Exeption is thrown in case the file is not found or file contains bad format.
The method looks something like:
Shape parse(String path) throws Exception {
// load file, parse file, guild graph
if ( file does contain bad format ) {
throw new Exception("bad format");
}
parse(newPath);
}
The exception will terminate my module since it will be caught in the application which uses my module, but that's alright since the format was bad.
What I would like to know is this - is it is a bad practice, throwing Exceptions from recursive functions like that?