ftsrg / gamma

An Eclipse-based modeling framework for the component-based design and analysis of reactive systems
http://gamma.inf.mit.bme.hu
30 stars 25 forks source link

Swallowed exception #165

Closed arminzavada closed 10 months ago

arminzavada commented 10 months ago

Swallowed exception hides valuable information.

https://github.com/ftsrg/gamma/blob/4f66c3ffd66a478aeb47e47ba9e7173932707e56/plugins/core/hu.bme.mit.gamma.language.util/src/hu/bme/mit/gamma/language/util/linking/GammaLanguageLinker.java#L92-L93

This line swallows the exception, assuming, that is means the path is incorrect. However, an exception could also be thrown if the path is correct, but the resource load failed for other reasons, in which case the details are valuable for the user to fix the issue.

Solution: Check the exception cause if it is of type FileNotFoundException.

grbeni commented 10 months ago

It was more complicated than this, but I introduced better exception handling in 4e6a368afe0ab3bb1c6f7df8e18feca294653998.

grbeni commented 10 months ago

Actually, invalid paths cause different kinds of exceptions in the case of different models, e.g., Yakindu. Thus, I reverted the changes in 99d1c6b8984f0b9cf7488d65c8ac90c86b2d3bb0.