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

refactor: Wrap a ton of stuff into try/catch and format #381

Merged

Conversation

EttyKitty
Copy link
Collaborator

@EttyKitty EttyKitty commented Jan 5, 2025

Description of changes

  • Wrap all things from critical bug reports into try/catch.
  • Format all the same things with the Gobo formatter.

Reasons for changes

  • Wraps are to prevent hard crashes.
  • Formatting is to improve visual clarity of code.

Related links

  • I'm not going to paste all of them, but I was just going through all critical bug reports that were crashing the game.

How have you tested your changes?

  • Compile
  • New game
  • Next turn
  • Space Travel
  • Ground Battle

Summary by Sourcery

Wrap critical code sections in try/catch blocks and apply consistent code formatting.

Bug Fixes:

  • Prevent hard crashes by wrapping critical code sections in try/catch blocks.

Enhancements:

  • Improve code readability through consistent formatting using the Gobo formatter.

Summary by Sourcery

Wrap exception handling around code related to critical bug reports and format it using the Gobo formatter.

Bug Fixes:

  • Prevent hard crashes by wrapping critical code sections in try/catch blocks.

Enhancements:

  • Improve code readability through consistent formatting using the Gobo formatter.

It was hard crashing the game otherwise.
Copy link
Contributor

sourcery-ai bot commented Jan 5, 2025

Reviewer's Guide by Sourcery

This pull request implements crash prevention and code formatting improvements. The changes involve wrapping code sections in try/catch blocks and applying the Gobo formatter.

File-Level Changes

Change Details Files
Wrapped code sections related to critical bug reports in try/catch blocks to prevent hard crashes.
  • Added try/catch blocks around various code sections to handle potential errors and prevent crashes.
  • Implemented exception handling to gracefully exit to the main menu in case of unexpected errors during specific operations.
  • Ensured that critical code blocks are protected by error handling mechanisms to maintain game stability.
objects/obj_creation/Draw_0.gml
objects/obj_popup/Step_0.gml
objects/obj_drop_select/Draw_64.gml
Formatted the code using the Gobo formatter to enhance readability and maintain consistency.
  • Applied the Gobo formatter to improve code style and consistency.
  • Reformatted code blocks for better visual clarity and maintainability.
  • Standardized code formatting to adhere to project guidelines and improve readability.
objects/obj_creation/Draw_0.gml
objects/obj_popup/Step_0.gml
scripts/NameGenerator/NameGenerator.gml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added PR: Refactor Rewriting/restructuring code, while keeping general behaviour PR: Major Coding Big enough to possibly clash with other PRs labels Jan 5, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Jan 5, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @EttyKitty - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding error logging within the catch blocks to help diagnose issues in production
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@EttyKitty EttyKitty requested a review from OH296 January 5, 2025 10:34
OH296
OH296 previously approved these changes Jan 5, 2025
@OH296
Copy link
Collaborator

OH296 commented Jan 5, 2025

@sourcery-ai review

@EttyKitty EttyKitty changed the title refactor: Wrap scr_add_vehicle into try/catch and format refactor: Wrap a ton of stuff into try/catch and format Jan 5, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Jan 5, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @EttyKitty - I've reviewed your changes - here's some feedback:

Overall Comments:

  • While adding error handling is a good improvement, consider implementing more granular error handling for different failure cases rather than just wrapping everything in try/catch and destroying instances. Also consider adding proper error logging before destroying instances to aid debugging.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@EttyKitty EttyKitty added PR: Code Style Not affecting how code works, only visual changes PR: Fix This is a fix for a bug labels Jan 5, 2025
@EttyKitty EttyKitty removed the PR: Fix This is a fix for a bug label Jan 5, 2025
@EttyKitty
Copy link
Collaborator Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @EttyKitty - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider handling specific exceptions instead of using blanket try/catch blocks to improve debugging and ensure only expected exceptions are caught.
  • Ensure that exceptions are logged or handled appropriately in the catch blocks to aid in diagnosing issues.
  • Consider adding automated tests to cover the critical paths wrapped in try/catch to ensure the changes don't introduce new bugs.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@EttyKitty EttyKitty merged commit b5be3d8 into Adeptus-Dominus:release/0.10.0.0 Jan 5, 2025
2 checks passed
@EttyKitty EttyKitty deleted the pr/try-catch-wraps branch January 5, 2025 18:23
pip.option3 = "Return your marines to the ship.";
pip.image = "ancient_ruins";
} catch (_exception) {
handle_exception(_exception);
Copy link
Collaborator

@OH296 OH296 Jan 5, 2025

Choose a reason for hiding this comment

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

Suggested change
handle_exception(_exception);
handle_exception(_exception);
instance_destroy();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Code Style Not affecting how code works, only visual changes PR: Major Coding Big enough to possibly clash with other PRs PR: Refactor Rewriting/restructuring code, while keeping general behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants