Skip to content

Refactor and Bug Fixes for Promise Handling and Validation #1402

Closed
@Viole07

Description

@Viole07

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.


Metadata

Metadata

Assignees

No one assigned

    Labels

    ⚠ Issue with an extensionAn issue with an extension that is already on the extension store

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions