Added more information to the thrown exception for malformed url.#951
Added more information to the thrown exception for malformed url.#951ffang merged 1 commit intoapache:masterfrom mibesis:feature_config_installer_url
Conversation
ffang
left a comment
There was a problem hiding this comment.
I prefer we still throw MalformedURLException(String detailed message) instead of IOException here.
Could you please revise accordingly?
Thanks!
|
Hi, I was using this now for few days. I would suggest to to have it IOException, with addition of adding origin exception. Why? Well, as is now ( change in PR ), "origin exception" is hidden, as I did not add the origin exception ( forgot about it ). So, the output does not contain origin error - that the "mvn:" prefix is not recognized. With suggested solution, there is another problem. I agree exception MalformedURLException would be more suited, but it does not have constructor to accept origin exception, plus in this case it only re-throws exception. Also, containing method declares as throws IOException, that is also in line with exception throws, so the user of this method can have less catch statements. IOException is also correct, because of the higher-level exception, that is a result of MalformedURLException -- think of it as: due to malformed URL, file was not found and could not be read ( IOException ). Based on all this, I suggest and think, that the exception IOException is the correct one to throw, but it is missing additional argument - origin exception, that is MalformedURLException and visible in a stacktrace, also accessible if needed. Please let me know what you think about this. Kind Regards, |
|
@miroslav-beranic , your explainition sounds good. Could you please also add origin MalformedURLException when construct the IOException you want to throw? |
Adding more information to the stacktrace what is the problem with the URL and for what Feature it is the problem.