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 and Bug Fixes for Promise Handling and Validation #1402

Open
1 task done
Viole07 opened this issue Oct 9, 2024 · 0 comments · May be fixed by #1403
Open
1 task done

Refactor and Bug Fixes for Promise Handling and Validation #1402

Viole07 opened this issue Oct 9, 2024 · 0 comments · May be fixed by #1403
Labels
⚠ Issue with an extension An issue with an extension that is already on the extension store

Comments

@Viole07
Copy link

Viole07 commented Oct 9, 2024

Is there an existing issue for this?

Enter the name of the extension

Promise Handling & Validation Refactor

Describe the bug of the extension

The current implementation of some key functions in the extension (such as verifyExtension.js and extract-extension.js) lacks consistent error handling and validation. This can lead to unhandled promise rejections, improper error reporting, and potential crashes when incorrect inputs are provided.

Steps to reproduce

  1. Go to the extension's folder.
  2. Attempt to load a zip file or JSON file with invalid names or structures.
  3. Observe inconsistent error handling or crashes.
  4. In some cases, file extraction might fail silently or without proper error messages.

GDevelop platform

Desktop

GDevelop version

5.1.160

Platform info

OS: Windows, Linux, macOS OS Version: Windows 10, macOS 11.0 Browser (for Web): Chrome, Firefox Device (for Mobile): N/A

Additional context


The refactor applies consistent async/await promise handling, improves type checking, and combines redundant loops in various scripts:

  • verifyExtension.js: Introduced a try-catch block for proper async error handling, added logging, and improved the flow of promise-based error management.
  • extract-extension.js: Wrapped operations in a try-catch block to streamline promise handling, preventing unhandled rejections.
  • ExtensionNameValidator.js: Added string validation for the extension name to avoid runtime errors from invalid inputs.
  • PascalCase.js: Combined loops to reduce code duplication and added type checking to ensure extension names are valid strings.

This improves the overall robustness of the extension and prevents crashes or silent failures in several key processes.


@Viole07 Viole07 added the ⚠ Issue with an extension An issue with an extension that is already on the extension store label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠ Issue with an extension An issue with an extension that is already on the extension store
Projects
None yet
1 participant