Repository: 4ian/GDevelop
File: GDJS/Runtime/pixi-renderers/pixi-bitmapfont-manager.ts (TypeScript)

Code before:
      if (!resource) {
        logger.warn(
          'Unable to find bitmap font for resource "' + resourceName + '".'
        );
        return;
      }
      if (this._loadedFontsData.get(resource)) {
        return;
      }

      try {
        const response = await fetch(
          this._resourceLoader.getFullUrl(resource.file),
          {
            credentials: this._resourceLoader.checkIfCredentialsRequired(
              resource.file
            )
              ? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
                // i.e: its gdevelop.io cookie, to be passed.
                'include'
              : // For other resources, use "same-origin" as done by default by fetch.
                'same-origin',
          }
        );
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }

        const fontDataRaw = await response.text();

        // Sanitize: remove lines starting with # (acting as comments)
        const sanitizedFontData = fontDataRaw
          .split('\n')
          .filter((line) => !line.trim().startsWith('#'))
          .join('\n');

        this._loadedFontsData.set(resource, sanitizedFontData);
      } catch (error) {
        logger.error(
          "Can't fetch the bitmap font file " +
            resource.file +
            ', error: ' +
            error
        );
        this._loadedFontsData.delete(resource);
        throw error;
      }
    }

    /**
     * To be called when the game is disposed.

Review comment (suggestion):
```suggestion
          throw new Error(`HTTP error while loading bitmap font. Status is ${sound.status}.`);
```

Code after:
      if (!resource) {
        logger.warn(
          'Unable to find bitmap font for resource "' + resourceName + '".'
        );
        return;
      }
      if (this._loadedFontsData.get(resource)) {
        return;
      }

      try {
        const response = await fetch(
          this._resourceLoader.getFullUrl(resource.file),
          {
            credentials: this._resourceLoader.checkIfCredentialsRequired(
              resource.file
            )
              ? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
                // i.e: its gdevelop.io cookie, to be passed.
                'include'
              : // For other resources, use "same-origin" as done by default by fetch.
                'same-origin',
          }
        );
        if (!response.ok) {
          throw new Error(
            `HTTP error while loading bitmap font. Status is ${response.status}.`
          );
        }

        const fontDataRaw = await response.text();

        // Sanitize: remove lines starting with # (acting as comments)
        const sanitizedFontData = fontDataRaw
          .split('\n')
          .filter((line) => !line.trim().startsWith('#'))
          .join('\n');

        this._loadedFontsData.set(resource, sanitizedFontData);
      } catch (error) {
        logger.error(
          "Can't fetch the bitmap font file " +
            resource.file +
            ', error: ' +
            error
        );
        this._loadedFontsData.delete(resource);
        throw error;
      }
    }