FXGL icon indicating copy to clipboard operation
FXGL copied to clipboard

when loadUI fails with FileNotFoundException it can not be caught

Open sputtering opened this issue 3 years ago • 1 comments

Describe the bug When loadUI files because of a FileNotFoundException, it does not stop execution nor is there a way to catch it

To Reproduce Steps to reproduce the behavior:

  1. Inside of the initUI procedure, put this code
        UI fxmlUI;
        try {
            fxmlUI = getAssetLoader().loadUI(new URL("file:///D:/Projects"), controller);
        getGameScene().addUI(fxmlUI);

        } catch (MalformedURLException  e) {
            System.out.println("" + e);
            System.exit(1);
        } 

Expected behavior If the URL is properly formed but no existent, the file won't be loaded but the program will continue

Runtime info(please complete the following information):

  • OS and version: Windows 10

sputtering avatar Mar 25 '23 01:03 sputtering

Sorry for delayed reply, yes, this is by design. We will keep going until we encounter an error we cannot recover from. However, any exceptions should be correctly reported in the log, typically using the WARN tag.

AlmasB avatar Feb 01 '24 22:02 AlmasB