Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure more export errors are reported to users #85845

Merged

Conversation

YuriSizov
Copy link
Contributor

@YuriSizov YuriSizov commented Dec 6, 2023

So apparently we don't have a good habit of adding export status messages when errors happen. This can lead to the export process failing without any concrete errors in the export log. This PR tries to address it to the best of my ability. In case some messages are still underreported, I've added a fallback error message to tell the users something.

godot windows editor dev x86_64_2023-12-06_13-47-48

It also fixes the timing issue when exporting all presets at the same time, where the error report would try to appear while the progress dialog was still visible. This leads to reports like #85814 focusing their attention on an irrelevant message.


Closes #85814, although I don't know what specifically blocks the users. But now, hopefully, they'll get a proper error message. It's probably cherry-pickable, but some edited code is messy so I would like a good review and some time for it to be tested before we consider that.

@@ -161,6 +161,7 @@ Error EditorExportPlatformPC::prepare_template(const Ref<EditorExportPreset> &p_
}
if (err != OK) {
add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Template"), TTR("Failed to copy export template."));
return err;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously, this is moot right now, but if we were to extend this function with more checks, this would ensure we aren't forgetting to return here.

Comment on lines +2865 to +2868
if (sdk_path.is_empty()) {
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("Android SDK path must be configured in Editor Settings at 'export/android/android_sdk_path'."));
return ERR_UNCONFIGURED;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we needed to use error macros in such places to begin with, but adding proper log messages will call ERR_PRINT for us anyway, so they can be removed.

Comment on lines -3305 to -3307
if (err != OK) {
CLEANUP_AND_RETURN(err);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to be necessary, we never reassign err since the last check above.

Comment on lines +248 to +251
if (err != OK) {
// Message is supplied by the subroutine method.
return err;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see a point in trying to export ZIP if we failed here already. Don't do it on Linux either.

Also fixes the timing issue when exporting all
presets at the same time, where the error report
would try to appear while the progress dialog
was still visible.
Comment on lines +1639 to +1642
// TODO: Improve error reporting by using `add_message` throughout all methods called via `_export_ios_plugins`.
// For now a generic top level message would be fine, but we're ought to use proper reporting here instead of
// just fail macros and non-descriptive error return values.
add_message(EXPORT_MESSAGE_ERROR, TTR("iOS Plugins"), vformat(TTR("Failed to export iOS plugins with code %d. Please check the output log."), err));
Copy link
Contributor Author

@YuriSizov YuriSizov Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave up, there is just too much inside of the call above that can return an error. And this whole method itself needs to be refactored. It's giant, does a lot of things and is pretty messy. If someone approaches this problem, hopefully this TODO will let them know what to improve.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the error conditions in the _export_ios_plugins seems to be forwarding error from _copy_asset (which have two error returns), all of them probably should not be ERR_ macros (since it's just adding unnecessary and non-informative messages) and should be changed to if (err != OK) return err;.

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Android section looks good!

Comment on lines +1639 to +1642
// TODO: Improve error reporting by using `add_message` throughout all methods called via `_export_ios_plugins`.
// For now a generic top level message would be fine, but we're ought to use proper reporting here instead of
// just fail macros and non-descriptive error return values.
add_message(EXPORT_MESSAGE_ERROR, TTR("iOS Plugins"), vformat(TTR("Failed to export iOS plugins with code %d. Please check the output log."), err));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the error conditions in the _export_ios_plugins seems to be forwarding error from _copy_asset (which have two error returns), all of them probably should not be ERR_ macros (since it's just adding unnecessary and non-informative messages) and should be changed to if (err != OK) return err;.

@YuriSizov YuriSizov merged commit 26ba706 into godotengine:master Dec 8, 2023
15 checks passed
@YuriSizov
Copy link
Contributor Author

Thanks for reviews!

@YuriSizov YuriSizov deleted the editor-export-hidden-errors branch December 8, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export to web fails with "Attempting to make child window exclusive" error
3 participants