In have written a function which expects the caller to pass in a configuration file like XML. Then I parse this given file and extract something which i then return.
In this function (at least) two "bad" things can happen:
- The given file does not exist or is not accessible in any way
- While parsing/validating the file some unexpected content is found
The first thing is clearly an
IllegalArgumentException. I am however not sure what kind of exception the second case would be. Is that also an
IllegalArgumentException because i expect (by documentation-contract) that the input is in a valid form? Or is it rather an
IllegalStateException as the given parameter is formal correct but only after parsing I can't do any further steps as it would result in unwanted behaviour?
Or is it even something else?