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

Improve error reporting of ProjectSettings::setup() #16825

Merged
merged 1 commit into from
Feb 19, 2018

Conversation

akien-mga
Copy link
Member

And use it to better report errors in the console and project manager
when a project.godot file is corrupted.

Fixes #14963.


Apart from fixing the referenced corner case issue, this new Error output is not used much yet, but I think that the code is cleaner and it will be useful to debug ProjectSettings::setup() to have it report the right error code.

I tried to retrieve the error code in main.cpp, but I got conflicts with the goto stuff... not sure how to go around it. Namely this diff:

diff --git a/main/main.cpp b/main/main.cpp
index a4ef35754..e48d4fd78 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -751,7 +751,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
 
 #endif
 
-       if (globals->setup(game_path, main_pack, upwards) != OK) {
+       Error err = globals->setup(game_path, main_pack, upwards);
+       if (err != OK) {
 
 #ifdef TOOLS_ENABLED
                editor = false;

Triggers this error:

main/main.cpp: In static member function 'static Error Main::setup(const char*, int, char**, bool)':
main/main.cpp:967:1: error: jump to label 'error' [-fpermissive]
 error:
 ^
main/main.cpp:724:9: note:   from here
    goto error;
         ^
main/main.cpp:754:8: note:   crosses initialization of 'Error err'
  Error err = globals->setup(game_path, main_pack, upwards);
        ^
main/main.cpp:967:1: error: jump to label 'error' [-fpermissive]
 error:
 ^
main/main.cpp:373:9: note:   from here
    goto error;
         ^
main/main.cpp:754:8: note:   crosses initialization of 'Error err'
  Error err = globals->setup(game_path, main_pack, upwards);
        ^

(and I checked, it's not a naming issue, using int as type or mycustomerr as variable name triggers the same issue)

And use it to better report errors in the console and project manager
when a project.godot file is corrupted.

Fixes godotengine#14963.
@akien-mga akien-mga added this to the 3.1 milestone Feb 19, 2018
@akien-mga akien-mga merged commit b2bdfad into godotengine:master Feb 19, 2018
@akien-mga akien-mga deleted the projectsettings-setup branch February 19, 2018 16:57
@akien-mga
Copy link
Member Author

Seems like this broke loading .pck files as noticed by @AndreaCatania. I'll look into fixing it tonight if nobody beats me to it.

@akien-mga
Copy link
Member Author

Fixed with 57d562b. Damn unreliable error reporting :p

akien-mga added a commit that referenced this pull request Feb 21, 2018
Regression introduced in #16825.
My logic was correct, but not the error code I was expecting.
The error reporting in FileAccess likely needs a review too.
hpvb pushed a commit that referenced this pull request Feb 22, 2018
Regression introduced in #16825.
My logic was correct, but not the error code I was expecting.
The error reporting in FileAccess likely needs a review too.

(cherry picked from commit 57d562b)
malcolmhoward pushed a commit to malcolmhoward/godot that referenced this pull request Jul 31, 2018
Regression introduced in godotengine#16825.
My logic was correct, but not the error code I was expecting.
The error reporting in FileAccess likely needs a review too.

(cherry picked from commit 57d562b)
malcolmhoward pushed a commit to malcolmhoward/godot that referenced this pull request Jul 31, 2018
Regression introduced in godotengine#16825.
My logic was correct, but not the error code I was expecting.
The error reporting in FileAccess likely needs a review too.

(cherry picked from commit 57d562b)
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.

Couldn't get project.godot in the project path
1 participant