Skip to content

Replaced many exit(1)s with exception raising #1468

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

Merged
merged 2 commits into from
Dec 14, 2018

Conversation

inclement
Copy link
Member

This both makes the code neater and will make it easier to test things.

@inclement inclement force-pushed the improve_fault_handling branch 2 times, most recently from 8be3e16 to ccb225a Compare November 18, 2018 15:54
@AndreMiras
Copy link
Member

I was wondering if test_invalid_recipe_order_and_bootstrap would pass, but indeed it didn't 😕

@@ -58,8 +59,7 @@ def check_python_dependencies():
ok = False

if not ok:
print('python-for-android is exiting due to the errors above.')
exit(1)
print('python-for-android is exiting due to the errors logged above')
Copy link

Choose a reason for hiding this comment

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

Should there be an error raised here? Or is this change intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

I originally did, but actually this code is run before most of the build process (because it has to run before the imports) so I think it needs a different treatment.

Copy link

@ghost ghost Dec 3, 2018

Choose a reason for hiding this comment

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

well but as it is, this seems to be a big change in behavior since the code flow just seems to resume. Is that intended? Maybe the exit should be left in if a runtime error doesn't make sense here? Or will this problem of not ok be evaluated again & properly dealt with later?

If you say it makes sense I'll take your word for it, I haven't looked at the followup code closely. it just seems like a potential trouble source breaking things

Copy link
Member Author

Choose a reason for hiding this comment

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

I also added the exit(1) back in with the previous comment, I missed that I'd accidentally removed it before so thanks for pointing it out!

Copy link

Choose a reason for hiding this comment

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

Ah right, the removing line is gone now. Didn't see that 😆

@inclement inclement force-pushed the improve_fault_handling branch 2 times, most recently from 03cddbb to c6deaa8 Compare December 3, 2018 22:06
@inclement
Copy link
Member Author

@AndreMiras Just rebased this to fix merge conflicts, any objections to merging it (if the tests pass)?

@ghost
Copy link

ghost commented Dec 3, 2018

Just to barge in, I have been eyeing this for a while and I think it's a really good code smell fix. Haven't commented so far since I haven't had the chance to test if it actually doesn't break stuff, but it looks like a thing really worth improving

ghost
ghost previously approved these changes Dec 3, 2018
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

haven't tested it 😬 but looks nice. and I think it's a really useful internal improvement

@@ -58,8 +59,7 @@ def check_python_dependencies():
ok = False

if not ok:
print('python-for-android is exiting due to the errors above.')
exit(1)
print('python-for-android is exiting due to the errors logged above')
Copy link

Choose a reason for hiding this comment

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

Ah right, the removing line is gone now. Didn't see that 😆

@AndreMiras
Copy link
Member

@AndreMiras Just rebased this to fix merge conflicts, any objections to merging it (if the tests pass)?

I also think it's a nice improvement, can't wait for it once the tests are passing indeed. We know the conditional build are now failing #1485 but the rest (e.g. linting) should be fixed before we can merge.

@AndreMiras
Copy link
Member

AndreMiras commented Dec 14, 2018

Hi @inclement can you give me write access to your improve_fault_handling branch so I can help to finish with this one?
We're almost there, I would be a pity to wait for that PR to conflict with other changes.
Edit:
Seems like I already have write access, so I'll give it a try 😄

@AndreMiras AndreMiras force-pushed the improve_fault_handling branch from 6ed21b4 to bec18e1 Compare December 14, 2018 22:17
Copy link
Member

@AndreMiras AndreMiras left a comment

Choose a reason for hiding this comment

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

Fixed rebase conflict, linter and unit tests, good to go

@AndreMiras AndreMiras merged commit 0dc5e83 into kivy:master Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants