Bug: Return value of FileBasedDocument::loadDocument() is ignored in JUCE 6.1.2

It seems that the return value of FileBasedDocument::loadDocument() is ignored in FileBasedDocument::loadFrom(). No matter what error result you return in loadDocument(), loadFrom() always returns the same error (“The file doesn’t exist”). The reason seems to be located in loadImpl() because it always creates the same error:

auto result = Result::fail (TRANS ("The file doesn't exist"));
if (showMessageOnFailure)
    AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
                                      TRANS ("Failed to open file..."),
                                      TRANS ("There was an error while trying to load the file: FLNM")
                                              .replace ("FLNM", "\n" + newFile.getFullPathName())
                                          + "\n\n"
                                          + result.getErrorMessage());

The resulting problem is, that whatever goes wrong during loadDocument() the error displayed to the user is “The file doesn’t exist”, what is wrong and misleading in many cases.

In JUCE 6.0.7 it works as expected.

Can anybody confirm my findings? Thank you very much!

Thanks, this looks like a bug. I’ll get that fixed.

Thank you! :slight_smile:

Thanks for reporting. This should now be fixed on develop: